Fixed Logger API Call in Chapter 10
MODIFY
src/Chapter10.Tests/Listing10.12.Tests.cs
src/Chapter10.Tests/Listing10.12.Tests.cs
@@ -13,12 +13,14 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter10.Listing10_12.Tests
[TestMethod]
public void Main_HospitalEmergencyCodes_DisplaysCodes()
{
- const string expected =
- @"info: Console[0]
+ string expected =
+ $"""
+ info: { typeof(Program).FullName }[0]
Hospital Emergency Codes: = 'black', 'blue', 'brown', 'CBR', 'orange', 'purple', 'red', 'yellow'
-warn: Console[0]
+ warn: { typeof(Program).FullName }[0]
This is a test of the emergency...
-";
+
+ """;
Action act = () => Program.Main(new[]
{

MODIFY
src/Chapter10/Listing10.12.LeveragingADifferentLibrary.cs
src/Chapter10/Listing10.12.LeveragingADifferentLibrary.cs
LoggerFactory.Create(builder =>
builder.AddConsole().AddDebug());
- ILogger logger = loggerFactory.CreateLogger(
- categoryName: "Console");
+ ILogger logger = loggerFactory.CreateLogger<Program>();
logger.LogInformation($@"Hospital Emergency Codes: = '{
string.Join("', '", args)}'");

Fixed Logger API Call in Chapter 10 (#419)