Removed stale code
MODIFY
src/Chapter16.Tests/Listing16.15.Tests.cs
src/Chapter16.Tests/Listing16.15.Tests.cs
@@ -11,8 +11,10 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter16.Listing16_15.Tests
[TestMethod]
public void SelectingAnonymousTypeFollowingGroupClause()
{
- string e = Shared.NetCore.GetNetCoreVersion() switch
+ string dotnetCoreVersion = Shared.NetCore.GetNetCoreVersion();
+ string expected = dotnetCoreVersion switch
{
+ // Version <= 5
string value when string.Compare(value, "6")<0 => """
Aggregate, All, Any, Append, AsEnumerable, Average, Cast, Concat, Contains,
Count, DefaultIfEmpty, Distinct, ElementAt, ElementAtOrDefault, Empty,
@@ -22,7 +24,8 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter16.Listing16_15.Tests
Single, SingleOrDefault, Skip, SkipLast, SkipWhile, Sum, Take, TakeLast, TakeWhile, ThenBy,
ThenByDescending, ToArray, ToDictionary, ToHashSet, ToList, ToLookup, Union, Where, Zip,
""",
- string value when string.Compare(value, "7")<0 => """
+ // Version 6
+ string value when value.StartsWith("6") => """
Aggregate, All, Any, Append, AsEnumerable, Average, Cast,
Chunk, Concat, Contains, Count, DefaultIfEmpty, Distinct, DistinctBy,
ElementAt, ElementAtOrDefault, Empty, Except, ExceptBy, First,
@@ -34,7 +37,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter16.Listing16_15.Tests
ThenByDescending, ToArray, ToDictionary, ToHashSet, ToList,
ToLookup, TryGetNonEnumeratedCount, Union, UnionBy, Where, Zip,
""",
- // Version 7.0
+ // Version 7
_ => """
Aggregate, All, Any, Append, AsEnumerable, Average, Cast,
Chunk, Concat, Contains, Count, DefaultIfEmpty, Distinct, DistinctBy,
@@ -49,50 +52,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter16.Listing16_15.Tests
"""
};
-
- // New lines added for output formatting in the chapter.
- string expected = """
- Aggregate, All, Any, Append, AsEnumerable, Average, Cast,
- Chunk, Concat, Contains, Count, DefaultIfEmpty, Distinct, DistinctBy,
- ElementAt, ElementAtOrDefault, Empty, Except, ExceptBy, First,
- FirstOrDefault, GroupBy, GroupJoin, Intersect, IntersectBy, Join,
- Last, LastOrDefault, LongCount, Max, MaxBy, Min, MinBy, OfType,
- Order, OrderBy, OrderByDescending, OrderDescending, Prepend, Range,
- Repeat, Reverse, Select, SelectMany, SequenceEqual, Single,
- SingleOrDefault, Skip, SkipLast, SkipWhile, Sum, Take, TakeLast,
- TakeWhile, ThenBy, ThenByDescending, ToArray, ToDictionary, ToHashSet,
- ToList, ToLookup, TryGetNonEnumeratedCount, Union, UnionBy, Where, Zip,
- """;
-
- TestContext.WriteLine(Shared.NetCore.GetNetCoreVersion());
- if (string.Compare(Shared.NetCore.GetNetCoreVersion(), "7") < 0)
- {
- expected = """
- Aggregate, All, Any, Append, AsEnumerable, Average, Cast,
- Chunk, Concat, Contains, Count, DefaultIfEmpty, Distinct, DistinctBy,
- ElementAt, ElementAtOrDefault, Empty, Except, ExceptBy, First,
- FirstOrDefault, GroupBy, GroupJoin, Intersect, IntersectBy, Join,
- Last, LastOrDefault, LongCount, Max, MaxBy, Min, MinBy, OfType,
- OrderBy, OrderByDescending, Prepend, Range, Repeat, Reverse,
- Select, SelectMany, SequenceEqual, Single, SingleOrDefault, Skip,
- SkipLast, SkipWhile, Sum, Take, TakeLast, TakeWhile, ThenBy,
- ThenByDescending, ToArray, ToDictionary, ToHashSet, ToList,
- ToLookup, TryGetNonEnumeratedCount, Union, UnionBy, Where, Zip,
- """;
-
- if (string.Compare(Shared.NetCore.GetNetCoreVersion(), "5") < 0)
- {
- expected = """
- Aggregate, All, Any, Append, AsEnumerable, Average, Cast, Concat, Contains,
- Count, DefaultIfEmpty, Distinct, ElementAt, ElementAtOrDefault, Empty,
- Except, First, FirstOrDefault, GroupBy, GroupJoin, Intersect, Join, Last,
- LastOrDefault, LongCount, Max, Min, OfType, OrderBy, OrderByDescending,
- Prepend, Range, Repeat, Reverse, Select, SelectMany, SequenceEqual,
- Single, SingleOrDefault, Skip, SkipLast, SkipWhile, Sum, Take, TakeLast, TakeWhile, ThenBy,
- ThenByDescending, ToArray, ToDictionary, ToHashSet, ToList, ToLookup, Union, Where, Zip,
- """;
- }
- }
+ TestContext.WriteLine(dotnetCoreVersion);
expected = expected.Replace("\r\n", string.Empty);
expected = expected.Replace("\n", string.Empty);

Removed stale code