Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# EssentialCSharp
[![Build and Test v9.0](https://github.com/IntelliTect/EssentialCSharp/actions/workflows/Branch%20v9.0.yml/badge.svg)](https://github.com/IntelliTect/EssentialCSharp/actions/workflows/Branch%20v9.0.yml)
[![Build and Test v9.0](https://github.com/IntelliTect/EssentialCSharp/actions/workflows/Branch%20v9.0.yml/badge.svg?branch=v9.0&event=push)](https://github.com/IntelliTect/EssentialCSharp/actions/workflows/Branch%20v9.0.yml)

This project contains the source code for the book **Essential C#** by Mark Michaelis (Addison-Wesley).

Expand Down
4 changes: 2 additions & 2 deletions src/Chapter03.Tests/Chapter03.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<Compile Include="..\Shared\CompilerAssert.cs" Link="CompilerAssert.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.Scripting.Common" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Scripting.Common" Version="4.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Chapter03\Chapter03.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public class UppercaseTests
[TestMethod]
async public Task UnassignedVariableThrowsError()
{
CompileError[] compileErrors = await CompilerAssert.ExpectErrorsInFileAsync(
_ = await CompilerAssert.ExpectErrorsInFileAsync(
"Listing03.02.DereferencingAnUnassignedVariable.cs",
new CompileError("CS0165: Use of unassigned local variable 'text'"));
new CompileError("CS0165", "Use of unassigned local variable 'text'"));
}
}
}
8 changes: 1 addition & 7 deletions src/Shared/CompilerAssert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,10 @@ async static public Task<CompileError[]> ExpectErrorsAsync(
for (int i = 0; i < actualCompileErrors.Length; i++)
{
// Compare Id's first as that is more meaningful.
Assert.AreEqual<string>(diagnostics[i].Message, actualCompileErrors[i].Message,
$"The expected Messages do not match for item {i}: " +
$"{diagnostics[i].Message} <> {diagnostics[i].Message}");
Assert.AreEqual<string>(diagnostics[i].Id, actualCompileErrors[i].Id,
$"The expected Ids do not match for item {i}: " +
$"{diagnostics[i].Id} <> {actualCompileErrors[i].Id}");
$"{diagnostics[i].Id}: {diagnostics[i].Message} <> {actualCompileErrors[i].Id}: {actualCompileErrors[i].Message}");
}
//CollectionAssert.AreEquivalent(
// diagnostics,
// actualCompileErrors.ToList());
}
return actualCompileErrors;
}
Expand Down