-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Get NetCore Preprocessor Directive, Reference Assembly, and Pac…
…kage Identity Dynamically (#584)
- Loading branch information
1 parent
fbe3d38
commit cdee374
Showing
20 changed files
with
102 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
namespace AddisonWesley.Michaelis.EssentialCSharp.Shared.Tests; | ||
|
||
[TestClass] | ||
public class NetCoreTests | ||
{ | ||
[TestMethod] | ||
public void GetAllValidNETPreprocessorSymbols_ContainsCorrectSymbols() | ||
{ | ||
List<string> preprocessorSymbols = NetCore.GetAllValidNETPreprocessorSymbols(8, 0).ToList(); | ||
CollectionAssert.Contains(preprocessorSymbols, "NET8_0"); | ||
CollectionAssert.Contains(preprocessorSymbols, "NET8_0_OR_GREATER"); | ||
CollectionAssert.Contains(preprocessorSymbols, "NET7_0_OR_GREATER"); | ||
CollectionAssert.Contains(preprocessorSymbols, "NET6_0_OR_GREATER"); | ||
CollectionAssert.Contains(preprocessorSymbols, "NET5_0_OR_GREATER"); | ||
CollectionAssert.Contains(preprocessorSymbols, "NETCOREAPP3_1_OR_GREATER"); | ||
CollectionAssert.Contains(preprocessorSymbols, "NETCOREAPP3_0_OR_GREATER"); | ||
|
||
Assert.AreEqual(preprocessorSymbols.Count, preprocessorSymbols.Distinct().Count()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 7 additions & 11 deletions
18
src/Chapter06/Listing06.39.SpecifyingRequiredMembersWithinTheObjectInitializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
#if NET7_0_OR_GREATER | ||
|
||
#if COMPILEERROR // EXCLUDE | ||
using AddisonWesley.Michaelis.EssentialCSharp.Chapter06.Listing06_38; | ||
#endif // COMPILEERROR // EXCLUDE | ||
#if NET7_0_OR_GREATER // EXCLUDE | ||
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter06.Listing06_39; | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter06.Listing06_39; | ||
using Listing06_38; | ||
|
||
public class Program | ||
{ | ||
public static void Main() | ||
{ | ||
#if COMPILEERROR // EXCLUDE | ||
#region INCLUDE | ||
// Error CS9035: | ||
// Required member 'Book.Isbn' must be set in the object | ||
// initializer or attribute constructor | ||
#if COMPILEERROR // EXCLUDE | ||
Book book = new() { Title= "Essential C#" }; | ||
#endif // COMPILEERROR // EXCLUDE | ||
|
||
// ... | ||
#endregion INCLUDE | ||
#endif // COMPILEERROR // EXCLUDE | ||
} | ||
} | ||
} | ||
#endif // NET7_0_OR_GREATER | ||
#endif // NET7_0_OR_GREATER // EXCLUDE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters