-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe6c335
commit bf0381c
Showing
4 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global using NUnit.Framework; |
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,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" /> | ||
<PackageReference Include="NUnit" Version="4.1.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> | ||
<PackageReference Include="NUnit.Analyzers" Version="4.1.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
</Project> |
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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Issue4670", "Issue4670.csproj", "{491A5BD4-1DCE-48C1-92AA-D39307FCD7A0}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{491A5BD4-1DCE-48C1-92AA-D39307FCD7A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{491A5BD4-1DCE-48C1-92AA-D39307FCD7A0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{491A5BD4-1DCE-48C1-92AA-D39307FCD7A0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{491A5BD4-1DCE-48C1-92AA-D39307FCD7A0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
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,28 @@ | ||
namespace Issue4670; | ||
|
||
public class Tests | ||
{ | ||
[Test] | ||
public void BugReport() | ||
{ | ||
var dictionary = new Dictionary<string, int> | ||
{ | ||
{ "a", 123 }, | ||
{ "b", 456 } | ||
}; | ||
|
||
Assert.Multiple(() => | ||
{ | ||
Assert.That(dictionary, Does.ContainKey("a").WithValue(456).Or.ContainKey("b").WithValue(123), "Passes but should fail"); | ||
Assert.That(dictionary, Does.ContainKey("a").WithValue(456).And.ContainKey("b").WithValue(456), "Passes but should fail"); | ||
|
||
// Expected: dictionary containing key "c" or dictionary containing entry ["c", 456] | ||
// But was: < ["a", 123], ["b", 456] > | ||
Assert.That(dictionary, Does.ContainKey("a").WithValue(123).Or.ContainKey("c").WithValue(456), "Fails but should pass"); | ||
|
||
// Expected: dictionary containing key "c" and dictionary containing entry ["c", 456] | ||
// But was: < ["a", 123], ["b", 456] > | ||
Assert.That(dictionary, Does.ContainKey("a").WithValue(123).And.ContainKey("c").WithValue(456), "Fails but for the wrong reason"); | ||
}); | ||
} | ||
} |