From 0dd078a162366c63f19011371e66f49f1e8d07b3 Mon Sep 17 00:00:00 2001 From: Chris Sivert Sylte Date: Wed, 27 Aug 2025 11:40:52 +0200 Subject: [PATCH 1/2] finished core --- csharp-fundamentals-lists.Test/CoreTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp-fundamentals-lists.Test/CoreTests.cs b/csharp-fundamentals-lists.Test/CoreTests.cs index a08fe06..de63c45 100644 --- a/csharp-fundamentals-lists.Test/CoreTests.cs +++ b/csharp-fundamentals-lists.Test/CoreTests.cs @@ -16,7 +16,7 @@ public CoreTests() public void Question1() { - Assert.IsTrue(_core.Question1().Contains("Phish Food", StringComparer.OrdinalIgnoreCase) && _core.Question1().Contains("Peanut Butter Cup", StringComparer.OrdinalIgnoreCase)); + Assert.IsTrue(_core.Question1().Contains("Banana", StringComparer.OrdinalIgnoreCase) && _core.Question1().Contains("Oreo", StringComparer.OrdinalIgnoreCase)); } [Test] From 523e38c9dac8df98aa17f5ba2878facde482b183 Mon Sep 17 00:00:00 2001 From: Chris Sivert Sylte Date: Wed, 27 Aug 2025 11:41:20 +0200 Subject: [PATCH 2/2] finished core --- csharp-fundamentals-lists.Main/Core.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/csharp-fundamentals-lists.Main/Core.cs b/csharp-fundamentals-lists.Main/Core.cs index 185c6d3..f1dac70 100644 --- a/csharp-fundamentals-lists.Main/Core.cs +++ b/csharp-fundamentals-lists.Main/Core.cs @@ -32,15 +32,21 @@ public List Question1() //write code here + _iceCreams.Add("Banana"); + _iceCreams.Add("Oreo"); + return _iceCreams; } public int Question2() { - + //TODO: find the lists method that returns the number of ice creams in the list and return this. // remove exception and write code here + + _iceCreams.ToList(); + throw new NotImplementedException(); } public List Question3() @@ -49,7 +55,7 @@ public List Question3() // The code below concatenates this.MoreIceCream to the _iceCreams list into a new results list. //TODO: you can 'chain' methods on the _iceCream list, so add another Concat to include EvenMoreIceCream (this is defined below) to the result list . e.g. _iceCreams.Concat(this.MoreIceCream).Concat(other list to concat).ToList() - List results = _iceCreams.Concat(this.MoreIceCream).ToList(); + List results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).ToList(); return results; @@ -65,7 +71,7 @@ public List Question4() // be sure to include the MoreIceCream and EvenMoreIceCream lists - List results = _iceCreams; + List results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList(); // remove exception and write code here return results; }