diff --git a/NHamcrest.sln b/NHamcrest.sln
index 080317d..72e9dc3 100644
--- a/NHamcrest.sln
+++ b/NHamcrest.sln
@@ -1,23 +1,23 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26403.7
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34003.232
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NUnit", "NUnit", "{9985B589-EC67-4FE7-83A1-3A68959CAAAC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XUnit", "XUnit", "{0EE42F24-2D10-425F-814F-F2C67431C5B7}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHamcrest.NUnit", "src\NHamcrest.NUnit\NHamcrest.NUnit.csproj", "{ED5F34C9-D815-46CD-BAC2-AC62A795894B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHamcrest.NUnit", "src\NHamcrest.NUnit\NHamcrest.NUnit.csproj", "{ED5F34C9-D815-46CD-BAC2-AC62A795894B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHamcrest.NUnit.Examples", "src\NHamcrest.NUnit.Examples\NHamcrest.NUnit.Examples.csproj", "{3047BC0C-DD71-4EC8-9835-15B9A41B2C62}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHamcrest.NUnit.Examples", "src\NHamcrest.NUnit.Examples\NHamcrest.NUnit.Examples.csproj", "{3047BC0C-DD71-4EC8-9835-15B9A41B2C62}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHamcrest.XUnit", "src\NHamcrest.XUnit\NHamcrest.XUnit.csproj", "{235F5147-DCDC-439C-9220-DF2E5FB23F66}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHamcrest.XUnit", "src\NHamcrest.XUnit\NHamcrest.XUnit.csproj", "{235F5147-DCDC-439C-9220-DF2E5FB23F66}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHamcrest.XUnit.Examples", "src\NHamcrest.XUnit.Examples\NHamcrest.XUnit.Examples.csproj", "{FB567185-A872-4D8E-A4C5-CC3D4430D7DF}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHamcrest.XUnit.Examples", "src\NHamcrest.XUnit.Examples\NHamcrest.XUnit.Examples.csproj", "{FB567185-A872-4D8E-A4C5-CC3D4430D7DF}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHamcrest", "src\NHamcrest\NHamcrest.csproj", "{BF7E7EB3-0C15-4F55-85F9-B2A7564D98D4}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHamcrest", "src\NHamcrest\NHamcrest.csproj", "{BF7E7EB3-0C15-4F55-85F9-B2A7564D98D4}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHamcrest.Tests", "src\NHamcrest.Tests\NHamcrest.Tests.csproj", "{368D7391-0C63-4F48-8D8C-3942E0693B92}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHamcrest.Tests", "src\NHamcrest.Tests\NHamcrest.Tests.csproj", "{368D7391-0C63-4F48-8D8C-3942E0693B92}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6554B7FF-2FE4-44AC-A33A-730FC30A0728}"
ProjectSection(SolutionItems) = preProject
diff --git a/src/NHamcrest.NUnit.Examples/NHamcrest.NUnit.Examples.csproj b/src/NHamcrest.NUnit.Examples/NHamcrest.NUnit.Examples.csproj
index 890f8b8..2c26989 100644
--- a/src/NHamcrest.NUnit.Examples/NHamcrest.NUnit.Examples.csproj
+++ b/src/NHamcrest.NUnit.Examples/NHamcrest.NUnit.Examples.csproj
@@ -4,7 +4,7 @@
net7.0
-
+
diff --git a/src/NHamcrest.Tests/Core/AnyOfTests.cs b/src/NHamcrest.Tests/Core/AnyOfTests.cs
index 60d8fa7..ad62994 100644
--- a/src/NHamcrest.Tests/Core/AnyOfTests.cs
+++ b/src/NHamcrest.Tests/Core/AnyOfTests.cs
@@ -1,7 +1,6 @@
+using NHamcrest.Core;
using System;
using System.Collections.Generic;
-
-using NHamcrest.Core;
using Xunit;
namespace NHamcrest.Tests.Core
@@ -11,7 +10,7 @@ public class AnyOfTests
private readonly CustomMatcher _failingMatcher = new CustomMatcher("Failing matcher", s => false);
private readonly CustomMatcher _successfulMatcher = new CustomMatcher("Successful matcher", s => true);
private readonly CustomMatcher _explodingMatcher = new CustomMatcher("Exploding matcher!",
- s => { throw new Exception("BANG!!!1!. Didn't expect exploding matcher to run."); });
+ s => throw new Exception("BANG!!!1!. Didn't expect exploding matcher to run."));
[Fact]
public void Match_if_any_matchers_succeed()
diff --git a/src/NHamcrest.Tests/Core/CombinableMatcherTests.cs b/src/NHamcrest.Tests/Core/CombinableMatcherTests.cs
index 4b6b349..c1f4cd7 100644
--- a/src/NHamcrest.Tests/Core/CombinableMatcherTests.cs
+++ b/src/NHamcrest.Tests/Core/CombinableMatcherTests.cs
@@ -1,4 +1,3 @@
-
using NHamcrest.Core;
using Xunit;
@@ -46,15 +45,15 @@ public void Either_returns_no_match_if_all_fail()
Assert.False(matcher.Matches(""));
}
- [Fact]
- public void DescribeTo()
- {
- var matcher = new CombinableMatcher(_failingMatcher);
- var description = new StringDescription();
+ [Fact]
+ public void DescribeTo()
+ {
+ var matcher = new CombinableMatcher(_failingMatcher);
+ var description = new StringDescription();
- matcher.DescribeTo(description);
+ matcher.DescribeTo(description);
- Assert.Equal("Failing matcher", description.ToString());
- }
+ Assert.Equal("Failing matcher", description.ToString());
+ }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/Core/EveryTests.cs b/src/NHamcrest.Tests/Core/EveryTests.cs
index c409906..c9ecfa8 100644
--- a/src/NHamcrest.Tests/Core/EveryTests.cs
+++ b/src/NHamcrest.Tests/Core/EveryTests.cs
@@ -1,4 +1,3 @@
-
using NHamcrest.Core;
using Xunit;
using Assert = NHamcrest.Tests.Internal.Assert;
@@ -7,13 +6,13 @@ namespace NHamcrest.Tests.Core
{
public class EveryTests
{
- private readonly IMatcher _startsWithA = new CustomMatcher("starts with an A",
+ private readonly IMatcher _startsWithA = new CustomMatcher("starts with an A",
s => s.StartsWith("A"));
[Fact]
public void Match_if_all_elements_match()
{
- var strings = new[] {"Aaaa", "Abbbb", "Acccc"};
+ var strings = new[] { "Aaaa", "Abbbb", "Acccc" };
Assert.That(strings, Every.Item(_startsWithA));
}
@@ -26,15 +25,15 @@ public void No_match_if_any_element_does_not_match()
Assert.That(strings, NotEvery.Item(_startsWithA));
}
- [Fact]
- public void Describe_to()
- {
- var matcher = Every.Item(_startsWithA);
- var description = new StringDescription();
+ [Fact]
+ public void Describe_to()
+ {
+ var matcher = Every.Item(_startsWithA);
+ var description = new StringDescription();
- matcher.DescribeTo(description);
+ matcher.DescribeTo(description);
- Assert.That(description.ToString(), Is.EqualTo("every item starts with an A"));
- }
+ Assert.That(description.ToString(), Is.EqualTo("every item starts with an A"));
+ }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/Core/IsAnythingTests.cs b/src/NHamcrest.Tests/Core/IsAnythingTests.cs
index c617193..4a643ae 100644
--- a/src/NHamcrest.Tests/Core/IsAnythingTests.cs
+++ b/src/NHamcrest.Tests/Core/IsAnythingTests.cs
@@ -1,4 +1,3 @@
-
using NHamcrest.Core;
using Xunit;
using Assert = NHamcrest.Tests.Internal.Assert;
diff --git a/src/NHamcrest.Tests/Core/IsCollectionContainingTests.cs b/src/NHamcrest.Tests/Core/IsCollectionContainingTests.cs
index 8fa490a..c6620da 100644
--- a/src/NHamcrest.Tests/Core/IsCollectionContainingTests.cs
+++ b/src/NHamcrest.Tests/Core/IsCollectionContainingTests.cs
@@ -1,4 +1,3 @@
-
using NHamcrest.Core;
using Xunit;
using Assert = NHamcrest.Tests.Internal.Assert;
@@ -10,7 +9,7 @@ public class IsCollectionContainingTests
[Fact]
public void Has_item()
{
- Assert.That(new[] {"aaa", "bbb", "ccc"}, Has.Item(Is.EqualTo("aaa")));
+ Assert.That(new[] { "aaa", "bbb", "ccc" }, Has.Item(Is.EqualTo("aaa")));
}
[Fact]
@@ -30,15 +29,15 @@ public void Describe_to_appends_matcher_description()
Assert.That(description.ToString(), Is.EqualTo("a collection containing \"aaa\""));
}
- [Fact]
- public void Describe_mismatch()
- {
- var matcher = Has.Item(Is.EqualTo("aaa"));
- var description = new StringDescription();
+ [Fact]
+ public void Describe_mismatch()
+ {
+ var matcher = Has.Item(Is.EqualTo("aaa"));
+ var description = new StringDescription();
- matcher.DescribeMismatch(new [] { "bbb", "ddd" }, description);
+ matcher.DescribeMismatch(new[] { "bbb", "ddd" }, description);
- Assert.That(description.ToString(), Is.EqualTo("was \"bbb\", was \"ddd\""));
- }
+ Assert.That(description.ToString(), Is.EqualTo("was \"bbb\", was \"ddd\""));
+ }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/Core/IsGreaterThanOrEqualToTests.cs b/src/NHamcrest.Tests/Core/IsGreaterThanOrEqualToTests.cs
index 1664bc3..a62e008 100644
--- a/src/NHamcrest.Tests/Core/IsGreaterThanOrEqualToTests.cs
+++ b/src/NHamcrest.Tests/Core/IsGreaterThanOrEqualToTests.cs
@@ -1,50 +1,49 @@
-
using NHamcrest.Core;
using Xunit;
using NHAssert = NHamcrest.Tests.Internal.Assert;
namespace NHamcrest.Tests.Core
{
- public class IsGreaterThanOrEqualToTests
- {
- [Fact]
- public void Match_if_greater()
- {
- const int five = 5;
+ public class IsGreaterThanOrEqualToTests
+ {
+ [Fact]
+ public void Match_if_greater()
+ {
+ const int five = 5;
- NHAssert.That(five, Is.GreaterThanOrEqualTo(3));
- }
+ NHAssert.That(five, Is.GreaterThanOrEqualTo(3));
+ }
- [Fact]
- public void No_match_if_less()
- {
- var isGreaterThanOrEqualToOne = new IsGreaterThanOrEqualTo(1);
+ [Fact]
+ public void No_match_if_less()
+ {
+ var isGreaterThanOrEqualToOne = new IsGreaterThanOrEqualTo(1);
- var matches = isGreaterThanOrEqualToOne.Matches(0);
+ var matches = isGreaterThanOrEqualToOne.Matches(0);
- Assert.False(matches);
- }
+ Assert.False(matches);
+ }
- [Fact]
- public void Match_if_equal()
- {
- var isGreaterThanOrEqualToOne = new IsGreaterThanOrEqualTo(1);
+ [Fact]
+ public void Match_if_equal()
+ {
+ var isGreaterThanOrEqualToOne = new IsGreaterThanOrEqualTo(1);
- var matches = isGreaterThanOrEqualToOne.Matches(1);
+ var matches = isGreaterThanOrEqualToOne.Matches(1);
- Assert.True(matches);
- }
+ Assert.True(matches);
+ }
- [Fact]
- public void Append_description()
- {
- const int six = 6;
- var greaterThan = Is.GreaterThanOrEqualTo(six);
- var description = new StringDescription();
+ [Fact]
+ public void Append_description()
+ {
+ const int six = 6;
+ var greaterThan = Is.GreaterThanOrEqualTo(six);
+ var description = new StringDescription();
- greaterThan.DescribeTo(description);
+ greaterThan.DescribeTo(description);
- Assert.Equal(description.ToString(), "greater than or equal to " + six);
- }
- }
+ Assert.Equal(description.ToString(), "greater than or equal to " + six);
+ }
+ }
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/Core/IsGreaterThanTests.cs b/src/NHamcrest.Tests/Core/IsGreaterThanTests.cs
index b23fb7c..ef03906 100644
--- a/src/NHamcrest.Tests/Core/IsGreaterThanTests.cs
+++ b/src/NHamcrest.Tests/Core/IsGreaterThanTests.cs
@@ -1,50 +1,49 @@
-
using NHamcrest.Core;
using Xunit;
using NHAssert = NHamcrest.Tests.Internal.Assert;
namespace NHamcrest.Tests.Core
{
- public class IsGreaterThanTests
- {
- [Fact]
- public void Match_if_greater()
- {
- const int five = 5;
+ public class IsGreaterThanTests
+ {
+ [Fact]
+ public void Match_if_greater()
+ {
+ const int five = 5;
- NHAssert.That(five, Is.GreaterThan(3));
- }
+ NHAssert.That(five, Is.GreaterThan(3));
+ }
- [Fact]
- public void No_match_if_not_greater()
- {
- var isGreaterThanOne = new IsGreaterThan(1);
+ [Fact]
+ public void No_match_if_not_greater()
+ {
+ var isGreaterThanOne = new IsGreaterThan(1);
- var matches = isGreaterThanOne.Matches(0);
+ var matches = isGreaterThanOne.Matches(0);
- Assert.False(matches);
- }
+ Assert.False(matches);
+ }
- [Fact]
- public void No_match_if_equal()
- {
- var isGreaterThanOne = new IsGreaterThan(1);
+ [Fact]
+ public void No_match_if_equal()
+ {
+ var isGreaterThanOne = new IsGreaterThan(1);
- var matches = isGreaterThanOne.Matches(1);
+ var matches = isGreaterThanOne.Matches(1);
- Assert.False(matches);
- }
+ Assert.False(matches);
+ }
- [Fact]
- public void Append_description()
- {
- const int six = 6;
- var greaterThan = Is.GreaterThan(six);
- var description = new StringDescription();
+ [Fact]
+ public void Append_description()
+ {
+ const int six = 6;
+ var greaterThan = Is.GreaterThan(six);
+ var description = new StringDescription();
- greaterThan.DescribeTo(description);
+ greaterThan.DescribeTo(description);
- Assert.Equal(description.ToString(), "greater than " + six);
- }
- }
+ Assert.Equal(description.ToString(), "greater than " + six);
+ }
+ }
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/Core/IsInstanceOfTests.cs b/src/NHamcrest.Tests/Core/IsInstanceOfTests.cs
index e5a461b..83f7095 100644
--- a/src/NHamcrest.Tests/Core/IsInstanceOfTests.cs
+++ b/src/NHamcrest.Tests/Core/IsInstanceOfTests.cs
@@ -1,4 +1,3 @@
-
using NHamcrest.Core;
using Xunit;
using Assert = NHamcrest.Tests.Internal.Assert;
@@ -53,7 +52,7 @@ public void Describe_mismatch()
matcher.DescribeMismatch(simonChurch, description);
- const string errorMessage = "Simon Church is an instance of NHamcrest.Tests.Core.IsInstanceOfTests+SimonChurch not" +
+ const string errorMessage = "Simon Church is an instance of NHamcrest.Tests.Core.IsInstanceOfTests+SimonChurch not" +
" NHamcrest.Tests.Core.IsInstanceOfTests+ShaneLong";
Assert.That(description.ToString(), Is.EqualTo(errorMessage));
}
diff --git a/src/NHamcrest.Tests/Core/IsLessThanOrEqualToTests.cs b/src/NHamcrest.Tests/Core/IsLessThanOrEqualToTests.cs
index 2ecd56c..75e00b0 100644
--- a/src/NHamcrest.Tests/Core/IsLessThanOrEqualToTests.cs
+++ b/src/NHamcrest.Tests/Core/IsLessThanOrEqualToTests.cs
@@ -1,50 +1,49 @@
-
using NHamcrest.Core;
using Xunit;
using NHAssert = NHamcrest.Tests.Internal.Assert;
namespace NHamcrest.Tests.Core
{
- public class IsLessThanOrEqualToTests
- {
- [Fact]
- public void Match_if_less()
- {
- const int five = 5;
+ public class IsLessThanOrEqualToTests
+ {
+ [Fact]
+ public void Match_if_less()
+ {
+ const int five = 5;
- NHAssert.That(five, Is.LessThanOrEqualTo(6));
- }
+ NHAssert.That(five, Is.LessThanOrEqualTo(6));
+ }
- [Fact]
- public void No_match_if_not_less()
- {
- var lessThanOrEqualTo = new IsLessThanOrEqualTo(8);
+ [Fact]
+ public void No_match_if_not_less()
+ {
+ var lessThanOrEqualTo = new IsLessThanOrEqualTo(8);
- var matches = lessThanOrEqualTo.Matches(9);
+ var matches = lessThanOrEqualTo.Matches(9);
- Assert.False(matches);
- }
+ Assert.False(matches);
+ }
- [Fact]
- public void Match_if_equal()
- {
- var isLessThanOrEqualTo = new IsLessThanOrEqualTo(8);
+ [Fact]
+ public void Match_if_equal()
+ {
+ var isLessThanOrEqualTo = new IsLessThanOrEqualTo(8);
- var matches = isLessThanOrEqualTo.Matches(8);
+ var matches = isLessThanOrEqualTo.Matches(8);
- Assert.True(matches);
- }
+ Assert.True(matches);
+ }
- [Fact]
- public void Append_description()
- {
- const int six = 6;
- var lessThan = Is.LessThanOrEqualTo(six);
- var description = new StringDescription();
+ [Fact]
+ public void Append_description()
+ {
+ const int six = 6;
+ var lessThan = Is.LessThanOrEqualTo(six);
+ var description = new StringDescription();
- lessThan.DescribeTo(description);
+ lessThan.DescribeTo(description);
- Assert.Equal(description.ToString(), "less than or equal to " + six);
- }
- }
+ Assert.Equal(description.ToString(), "less than or equal to " + six);
+ }
+ }
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/Core/IsLessThanTests.cs b/src/NHamcrest.Tests/Core/IsLessThanTests.cs
index da68bec..e743569 100644
--- a/src/NHamcrest.Tests/Core/IsLessThanTests.cs
+++ b/src/NHamcrest.Tests/Core/IsLessThanTests.cs
@@ -1,50 +1,49 @@
-
using NHamcrest.Core;
using Xunit;
using NHAssert = NHamcrest.Tests.Internal.Assert;
namespace NHamcrest.Tests.Core
{
- public class IsLessThanTests
- {
- [Fact]
- public void Match_if_less()
- {
- const int five = 5;
+ public class IsLessThanTests
+ {
+ [Fact]
+ public void Match_if_less()
+ {
+ const int five = 5;
- NHAssert.That(five, Is.LessThan(6));
- }
+ NHAssert.That(five, Is.LessThan(6));
+ }
- [Fact]
- public void No_match_if_not_less()
- {
- var isLessThanEight = new IsLessThan(8);
+ [Fact]
+ public void No_match_if_not_less()
+ {
+ var isLessThanEight = new IsLessThan(8);
- var matches = isLessThanEight.Matches(9);
+ var matches = isLessThanEight.Matches(9);
- Assert.False(matches);
- }
+ Assert.False(matches);
+ }
- [Fact]
- public void No_match_if_equal()
- {
- var isLessThanEight = new IsLessThan(8);
+ [Fact]
+ public void No_match_if_equal()
+ {
+ var isLessThanEight = new IsLessThan(8);
- var matches = isLessThanEight.Matches(8);
+ var matches = isLessThanEight.Matches(8);
- Assert.False(matches);
- }
+ Assert.False(matches);
+ }
- [Fact]
- public void Append_description()
- {
- const int six = 6;
- var lessThan = Is.LessThan(six);
- var description = new StringDescription();
+ [Fact]
+ public void Append_description()
+ {
+ const int six = 6;
+ var lessThan = Is.LessThan(six);
+ var description = new StringDescription();
- lessThan.DescribeTo(description);
+ lessThan.DescribeTo(description);
- Assert.Equal(description.ToString(), "less than " + six);
- }
- }
+ Assert.Equal(description.ToString(), "less than " + six);
+ }
+ }
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/Core/IsNotTests.cs b/src/NHamcrest.Tests/Core/IsNotTests.cs
index 356ad52..65b1707 100644
--- a/src/NHamcrest.Tests/Core/IsNotTests.cs
+++ b/src/NHamcrest.Tests/Core/IsNotTests.cs
@@ -1,7 +1,5 @@
-
using NHamcrest.Core;
using Xunit;
-using NHamcrest.XUnit;
using Assert = NHamcrest.XUnit.Assert;
namespace NHamcrest.Tests.Core
diff --git a/src/NHamcrest.Tests/Core/IsNullTests.cs b/src/NHamcrest.Tests/Core/IsNullTests.cs
index b484d10..25d04f1 100644
--- a/src/NHamcrest.Tests/Core/IsNullTests.cs
+++ b/src/NHamcrest.Tests/Core/IsNullTests.cs
@@ -1,4 +1,3 @@
-
using NHamcrest.Core;
using Xunit;
using Assert = NHamcrest.Tests.Internal.Assert;
diff --git a/src/NHamcrest.Tests/Core/IsSameTests.cs b/src/NHamcrest.Tests/Core/IsSameTests.cs
index fae9d32..98843ff 100644
--- a/src/NHamcrest.Tests/Core/IsSameTests.cs
+++ b/src/NHamcrest.Tests/Core/IsSameTests.cs
@@ -1,4 +1,3 @@
-
using NHamcrest.Core;
using Xunit;
using Assert = NHamcrest.Tests.Internal.Assert;
@@ -11,7 +10,7 @@ public class IsSameTests
public void Match_if_same_object()
{
var a = new A();
-
+
Assert.That(a, Is.SameAs(a));
}
diff --git a/src/NHamcrest.Tests/Core/StringContainsTests.cs b/src/NHamcrest.Tests/Core/StringContainsTests.cs
index 9b0b978..bafeade 100644
--- a/src/NHamcrest.Tests/Core/StringContainsTests.cs
+++ b/src/NHamcrest.Tests/Core/StringContainsTests.cs
@@ -1,4 +1,3 @@
-
using NHamcrest.Core;
using Xunit;
using Assert = NHamcrest.Tests.Internal.Assert;
diff --git a/src/NHamcrest.Tests/Core/StringStartsWithTests.cs b/src/NHamcrest.Tests/Core/StringStartsWithTests.cs
index b0d2839..2f486de 100644
--- a/src/NHamcrest.Tests/Core/StringStartsWithTests.cs
+++ b/src/NHamcrest.Tests/Core/StringStartsWithTests.cs
@@ -1,4 +1,3 @@
-
using NHamcrest.Core;
using Xunit;
using Assert = NHamcrest.Tests.Internal.Assert;
diff --git a/src/NHamcrest.Tests/Core/ThrowsTests.cs b/src/NHamcrest.Tests/Core/ThrowsTests.cs
index 98453d1..383ce5b 100644
--- a/src/NHamcrest.Tests/Core/ThrowsTests.cs
+++ b/src/NHamcrest.Tests/Core/ThrowsTests.cs
@@ -1,108 +1,109 @@
-using System;
using NHamcrest.Core;
+using System;
using Xunit;
using NHAssert = NHamcrest.Tests.Internal.Assert;
namespace NHamcrest.Tests.Core
{
- public class ThrowsTests
- {
- [Fact]
- public void Describe_matcher()
- {
- var matcher = new ThrowsMatcher();
- var description = new StringDescription();
-
- matcher.DescribeTo(description);
-
- NHAssert.That(description.ToString(), Is.EqualTo("the block to throw an exception of type System.ArgumentNullException"));
- }
-
- [Fact]
- public void Match_if_action_throws_expected_exception()
- {
- NHAssert.That(() => DoIt(), Throws.An());
- }
-
- [Fact]
- public void Match_if_action_throws_superclass_of_expected_exception()
- {
- NHAssert.That(() => DoIt(), Throws.An());
- }
-
- [Fact]
- public void No_match_if_action_does_not_throw()
- {
- var matcher = new ThrowsMatcher();
-
- var match = matcher.Matches(() => { });
-
- NHAssert.That(match, Is.False());
- }
-
- [Fact]
- public void Describe_mismatch_if_action_does_not_throw()
- {
- var matcher = new ThrowsMatcher();
- var description = new StringDescription();
-
- matcher.DescribeMismatch(() => { }, description);
-
- NHAssert.That(description.ToString(), Is.EqualTo("no exception was thrown"));
- }
-
- [Fact]
- public void No_match_if_action_throws_different_exception()
- {
- var matcher = new ThrowsMatcher();
-
- var match = matcher.Matches(DoIt);
-
- NHAssert.That(match, Is.False());
- }
-
- [Fact]
- public void Describe_mismatch_if_action_throws_different_exception()
- {
- var matcher = new ThrowsMatcher();
- var description = new StringDescription();
-
- matcher.DescribeMismatch(DoIt, description);
-
- NHAssert.That(description.ToString(), Starts.With("an exception of type System.ArgumentNullException was thrown"));
- }
-
- [Fact]
- public void Match_if_thrown_exception_matches_predicate()
- {
- NHAssert.That(DoIt, Throws.An().With(e => e.Message == "message"
- && e.InnerException.GetType() == typeof(Exception)));
- }
-
- [Fact]
- public void No_match_if_thrown_exception_does_not_match_predicate()
- {
- var matcher = new ThrowsMatcher().With(e => e.Message == "something else");
-
- var matches = matcher.Matches(DoIt);
-
- NHAssert.That(matches, Is.False());
- }
-
- [Fact]
- public void Describe_mismatch_if_thrown_exception_does_not_match_predicate()
- {
- var matcher = new ThrowsMatcher().With(e => e.Message == "something else");
- var description = new StringDescription();
-
- matcher.DescribeMismatch(DoIt, description);
-
- NHAssert.That(description.ToString(), Starts.With("the exception was of the correct type, but did not match the predicate"));
- }
-
- private void DoIt()
- {
- throw new ArgumentNullException("message", new Exception());
- }
- }
+ public class ThrowsTests
+ {
+ [Fact]
+ public void Describe_matcher()
+ {
+ var matcher = new ThrowsMatcher();
+ var description = new StringDescription();
+
+ matcher.DescribeTo(description);
+
+ NHAssert.That(description.ToString(), Is.EqualTo("the block to throw an exception of type System.ArgumentNullException"));
+ }
+
+ [Fact]
+ public void Match_if_action_throws_expected_exception()
+ {
+ NHAssert.That(DoIt, Throws.An());
+ }
+
+ [Fact]
+ public void Match_if_action_throws_superclass_of_expected_exception()
+ {
+ NHAssert.That(DoIt, Throws.An());
+ }
+
+ [Fact]
+ public void No_match_if_action_does_not_throw()
+ {
+ var matcher = new ThrowsMatcher();
+
+ var match = matcher.Matches(() => { });
+
+ NHAssert.That(match, Is.False());
+ }
+
+ [Fact]
+ public void Describe_mismatch_if_action_does_not_throw()
+ {
+ var matcher = new ThrowsMatcher();
+ var description = new StringDescription();
+
+ matcher.DescribeMismatch(() => { }, description);
+
+ NHAssert.That(description.ToString(), Is.EqualTo("no exception was thrown"));
+ }
+
+ [Fact]
+ public void No_match_if_action_throws_different_exception()
+ {
+ var matcher = new ThrowsMatcher();
+
+ var match = matcher.Matches(DoIt);
+
+ NHAssert.That(match, Is.False());
+ }
+
+ [Fact]
+ public void Describe_mismatch_if_action_throws_different_exception()
+ {
+ var matcher = new ThrowsMatcher();
+ var description = new StringDescription();
+
+ matcher.DescribeMismatch(DoIt, description);
+
+ NHAssert.That(description.ToString(), Starts.With("an exception of type System.ArgumentNullException was thrown"));
+ }
+
+ [Fact]
+ public void Match_if_thrown_exception_matches_predicate()
+ {
+ NHAssert.That(DoIt, Throws.An()
+ .With(e => e.Message == "message" && e.InnerException.GetType() == typeof(Exception)));
+ }
+
+ [Fact]
+ public void No_match_if_thrown_exception_does_not_match_predicate()
+ {
+ var matcher = new ThrowsMatcher()
+ .With(e => e.Message == "something else");
+
+ var matches = matcher.Matches(DoIt);
+
+ NHAssert.That(matches, Is.False());
+ }
+
+ [Fact]
+ public void Describe_mismatch_if_thrown_exception_does_not_match_predicate()
+ {
+ var matcher = new ThrowsMatcher().With(e => e.Message == "something else");
+ var description = new StringDescription();
+
+ matcher.DescribeMismatch(DoIt, description);
+
+ NHAssert.That(description.ToString(), Starts.With("the exception was of the correct type, but did not match the predicate"));
+ }
+
+ private void DoIt()
+ {
+ throw new ArgumentNullException("message", new Exception());
+ }
+ }
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/CustomMatcherTests.cs b/src/NHamcrest.Tests/CustomMatcherTests.cs
index 5b5e5a2..a6c6b4e 100644
--- a/src/NHamcrest.Tests/CustomMatcherTests.cs
+++ b/src/NHamcrest.Tests/CustomMatcherTests.cs
@@ -1,9 +1,8 @@
-using System;
-using Moq;
using NHamcrest.Core;
+using NSubstitute;
+using System;
using Xunit;
-
namespace NHamcrest.Tests
{
public class CustomMatcherTests
@@ -19,12 +18,11 @@ public void DescribeTo_appends_provided_description()
{
const string fixedDescription = "description";
var matcher = new CustomMatcher(fixedDescription, s => true);
- var descriptionMock = new Mock();
+ var descriptionMock = Substitute.For();
- matcher.DescribeTo(descriptionMock.Object);
+ matcher.DescribeTo(descriptionMock);
- descriptionMock.Verify(d => d.AppendText(fixedDescription), Times.Once);
- //o => o.Message("AppendText was not called on the provided IDescription."));
+ descriptionMock.Received().AppendText(fixedDescription);
}
[Fact]
diff --git a/src/NHamcrest.Tests/DescriptionTests.cs b/src/NHamcrest.Tests/DescriptionTests.cs
index 4b1daaa..54bf27a 100644
--- a/src/NHamcrest.Tests/DescriptionTests.cs
+++ b/src/NHamcrest.Tests/DescriptionTests.cs
@@ -1,11 +1,9 @@
-using System;
+using NHamcrest.Core;
+using NSubstitute;
using System.Collections.Generic;
using System.Text;
-using Moq;
-using NHamcrest.Core;
using Xunit;
-
namespace NHamcrest.Tests
{
public class DescriptionTests
@@ -28,11 +26,11 @@ public void None_returns_a_null_description()
[Fact]
public void AppendDescriptionOf_asks_value_to_describe_itself()
{
- var selfDescribingMock = new Mock();
+ var selfDescribingMock = Substitute.For();
- _description.AppendDescriptionOf(selfDescribingMock.Object);
+ _description.AppendDescriptionOf(selfDescribingMock);
- selfDescribingMock.Verify(sd => sd.DescribeTo(_description), Times.Once);
+ selfDescribingMock.Received().DescribeTo(_description);
}
[Fact]
diff --git a/src/NHamcrest.Tests/DiagnosingMatcherTests.cs b/src/NHamcrest.Tests/DiagnosingMatcherTests.cs
index 9f8f659..361702b 100644
--- a/src/NHamcrest.Tests/DiagnosingMatcherTests.cs
+++ b/src/NHamcrest.Tests/DiagnosingMatcherTests.cs
@@ -1,8 +1,7 @@
-using System;
using NHamcrest.Core;
+using System;
using Xunit;
-
namespace NHamcrest.Tests
{
public class DiagnosingMatcherTests
@@ -48,10 +47,9 @@ public TestDiagnosingMatcher(Func match)
protected override bool Matches(string item, IDescription mismatchDescription)
{
- if (mismatchDescription.GetType() != typeof(NullDescription))
- throw new Exception("Expected null description");
-
- return _match(item);
+ return mismatchDescription.GetType() != typeof(NullDescription)
+ ? throw new Exception("Expected null description")
+ : _match(item);
}
}
}
diff --git a/src/NHamcrest.Tests/FeatureMatcherDescriptionTests.cs b/src/NHamcrest.Tests/FeatureMatcherDescriptionTests.cs
index 2ff8736..7a03406 100644
--- a/src/NHamcrest.Tests/FeatureMatcherDescriptionTests.cs
+++ b/src/NHamcrest.Tests/FeatureMatcherDescriptionTests.cs
@@ -1,5 +1,5 @@
-using System;
-using NHamcrest.Tests.TestClasses;
+using NHamcrest.Tests.TestClasses;
+using System;
using Xunit;
namespace NHamcrest.Tests
diff --git a/src/NHamcrest.Tests/Internal/Assert.cs b/src/NHamcrest.Tests/Internal/Assert.cs
index 9d93b25..66f0c85 100644
--- a/src/NHamcrest.Tests/Internal/Assert.cs
+++ b/src/NHamcrest.Tests/Internal/Assert.cs
@@ -12,8 +12,10 @@ public static void That(T actual, IMatcher matcher)
private static void That(T actual, IMatcher matcher, string reason)
{
if (matcher.Matches(actual))
+ {
return;
-
+ }
+
var description = new StringDescription();
description.AppendText(reason)
.AppendText("\nExpected: ")
diff --git a/src/NHamcrest.Tests/Internal/SelfDescribingValueTests.cs b/src/NHamcrest.Tests/Internal/SelfDescribingValueTests.cs
index 83ae46d..94edfd7 100644
--- a/src/NHamcrest.Tests/Internal/SelfDescribingValueTests.cs
+++ b/src/NHamcrest.Tests/Internal/SelfDescribingValueTests.cs
@@ -1,7 +1,5 @@
-using Moq;
using Xunit;
-
namespace NHamcrest.Tests.Internal
{
public class SelfDescribingValueTests
diff --git a/src/NHamcrest.Tests/MatcherTests.cs b/src/NHamcrest.Tests/MatcherTests.cs
index 2740b9c..4cdce63 100644
--- a/src/NHamcrest.Tests/MatcherTests.cs
+++ b/src/NHamcrest.Tests/MatcherTests.cs
@@ -1,6 +1,5 @@
-
-using Moq;
using NHamcrest.Core;
+using NSubstitute;
using Xunit;
namespace NHamcrest.Tests
@@ -10,15 +9,15 @@ public class MatcherTests
[Fact]
public void DescribeMismatch_appends_item()
{
- var matcher = new TestMatcher();
- var descriptionMock = new Mock();
- descriptionMock.Setup(d => d.AppendText(It.IsAny())).Returns(descriptionMock.Object);
const string item = "item";
+ var matcher = new TestMatcher();
+ var descriptionMock = Substitute.For();
+ descriptionMock.AppendText(Arg.Any()).Returns(descriptionMock);
- matcher.DescribeMismatch(item, descriptionMock.Object);
+ matcher.DescribeMismatch(item, descriptionMock);
- descriptionMock.Verify(d => d.AppendText("was "), Times.Once);
- descriptionMock.Verify(d => d.AppendValue(item), Times.Once);
+ descriptionMock.AppendText("was ").Received();
+ descriptionMock.AppendValue(item).Received();
}
[Fact]
diff --git a/src/NHamcrest.Tests/NHamcrest.Tests.csproj b/src/NHamcrest.Tests/NHamcrest.Tests.csproj
index 14f3dc5..accfb5a 100644
--- a/src/NHamcrest.Tests/NHamcrest.Tests.csproj
+++ b/src/NHamcrest.Tests/NHamcrest.Tests.csproj
@@ -9,14 +9,14 @@
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
diff --git a/src/NHamcrest.Tests/NonNullDiagnosingMatcherTests.cs b/src/NHamcrest.Tests/NonNullDiagnosingMatcherTests.cs
index fbac995..2d6bce7 100644
--- a/src/NHamcrest.Tests/NonNullDiagnosingMatcherTests.cs
+++ b/src/NHamcrest.Tests/NonNullDiagnosingMatcherTests.cs
@@ -1,5 +1,5 @@
-using System;
using NHamcrest.Core;
+using System;
using Xunit;
namespace NHamcrest.Tests
diff --git a/src/NHamcrest.Tests/NonNullMatcherTests.cs b/src/NHamcrest.Tests/NonNullMatcherTests.cs
index 40d88ad..7928ab4 100644
--- a/src/NHamcrest.Tests/NonNullMatcherTests.cs
+++ b/src/NHamcrest.Tests/NonNullMatcherTests.cs
@@ -1,6 +1,5 @@
-
-using System;
using NHamcrest.Core;
+using System;
using Xunit;
namespace NHamcrest.Tests
diff --git a/src/NHamcrest.Tests/NullDescriptionTests.cs b/src/NHamcrest.Tests/NullDescriptionTests.cs
index ce4b474..8cd3f43 100644
--- a/src/NHamcrest.Tests/NullDescriptionTests.cs
+++ b/src/NHamcrest.Tests/NullDescriptionTests.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using NHamcrest.Core;
+using System.Collections.Generic;
using Xunit;
namespace NHamcrest.Tests
diff --git a/src/NHamcrest.Tests/StringDescriptionTests.cs b/src/NHamcrest.Tests/StringDescriptionTests.cs
index c4cf100..1403835 100644
--- a/src/NHamcrest.Tests/StringDescriptionTests.cs
+++ b/src/NHamcrest.Tests/StringDescriptionTests.cs
@@ -1,5 +1,5 @@
-using System.Text;
-using NHamcrest.Core;
+using NHamcrest.Core;
+using System.Text;
using Xunit;
namespace NHamcrest.Tests
diff --git a/src/NHamcrest.Tests/StructuralComparisonMatcherFactoryFailureTest.cs b/src/NHamcrest.Tests/StructuralComparisonMatcherFactoryFailureTest.cs
index ba97818..ca5a339 100644
--- a/src/NHamcrest.Tests/StructuralComparisonMatcherFactoryFailureTest.cs
+++ b/src/NHamcrest.Tests/StructuralComparisonMatcherFactoryFailureTest.cs
@@ -31,9 +31,11 @@ public void MatcherShouldNotMatchValue()
public void MismatchDescriptionMustBeCorrect()
{
var description = new StringDescription();
- _matcher.DescribeMismatch(_matched, description);
var expected = ExpectMismatchDescription();
+
+ _matcher.DescribeMismatch(_matched, description);
var actual = description.ToString();
+
Xunit.Assert.Equal(expected, actual);
}
@@ -42,6 +44,7 @@ public void MatcherDescriptionMustBeCorrect()
{
var expected = ExpectMatcherDescription();
var description = new StringDescription();
+
_matcher.DescribeTo(description);
var actual = description.ToString();
diff --git a/src/NHamcrest.Tests/StructuralComparisonMatcherFactorySuccessTest.cs b/src/NHamcrest.Tests/StructuralComparisonMatcherFactorySuccessTest.cs
index 806e63a..a7933cd 100644
--- a/src/NHamcrest.Tests/StructuralComparisonMatcherFactorySuccessTest.cs
+++ b/src/NHamcrest.Tests/StructuralComparisonMatcherFactorySuccessTest.cs
@@ -35,6 +35,7 @@ public void MatcherDescriptionMustBeCorrect()
{
var expected = ExpectMatcherDescription();
var description = new StringDescription();
+
_matcher.DescribeTo(description);
var actual = description.ToString();
diff --git a/src/NHamcrest.Tests/TestClasses/ClassWithArrayOfClasses.cs b/src/NHamcrest.Tests/TestClasses/ClassWithArrayOfClasses.cs
index 6bf7978..4f835a7 100644
--- a/src/NHamcrest.Tests/TestClasses/ClassWithArrayOfClasses.cs
+++ b/src/NHamcrest.Tests/TestClasses/ClassWithArrayOfClasses.cs
@@ -5,6 +5,7 @@ namespace NHamcrest.Tests.TestClasses
public class ClassWithArrayOfClasses
{
public Guid Id { get; set; }
+
public SimpleFlatClass[] OtherThings { get; set; }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/TestClasses/ClassWithDictionaryOfClasses.cs b/src/NHamcrest.Tests/TestClasses/ClassWithDictionaryOfClasses.cs
index ff99a82..8bfa57f 100644
--- a/src/NHamcrest.Tests/TestClasses/ClassWithDictionaryOfClasses.cs
+++ b/src/NHamcrest.Tests/TestClasses/ClassWithDictionaryOfClasses.cs
@@ -5,6 +5,7 @@ namespace NHamcrest.Tests.TestClasses
public class ClassWithDictionaryOfClasses
{
public string StringValue { get; set; }
+
public Dictionary Map { get; set; }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/TestClasses/ClassWithEnumerableOfClasses.cs b/src/NHamcrest.Tests/TestClasses/ClassWithEnumerableOfClasses.cs
index ff7c69f..979db27 100644
--- a/src/NHamcrest.Tests/TestClasses/ClassWithEnumerableOfClasses.cs
+++ b/src/NHamcrest.Tests/TestClasses/ClassWithEnumerableOfClasses.cs
@@ -5,6 +5,7 @@ namespace NHamcrest.Tests.TestClasses
public class ClassWithEnumerableOfClasses
{
public int IntValue { get; set; }
+
public IEnumerable OtherThings { get; set; }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/TestClasses/ClassWithListOfClasses.cs b/src/NHamcrest.Tests/TestClasses/ClassWithListOfClasses.cs
index a6d3aa2..126e053 100644
--- a/src/NHamcrest.Tests/TestClasses/ClassWithListOfClasses.cs
+++ b/src/NHamcrest.Tests/TestClasses/ClassWithListOfClasses.cs
@@ -5,6 +5,7 @@ namespace NHamcrest.Tests.TestClasses
public class ClassWithListOfClasses
{
public int IntValue { get; set; }
+
public List OtherThings { get; set; }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/TestClasses/DoubleNestedClass.cs b/src/NHamcrest.Tests/TestClasses/DoubleNestedClass.cs
index fd49226..bb3cef4 100644
--- a/src/NHamcrest.Tests/TestClasses/DoubleNestedClass.cs
+++ b/src/NHamcrest.Tests/TestClasses/DoubleNestedClass.cs
@@ -3,6 +3,7 @@
public class DoubleNestedClass
{
public float Coefficient { get; set; }
+
public NestedClass Nested { get; set; }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/TestClasses/NestedClass.cs b/src/NHamcrest.Tests/TestClasses/NestedClass.cs
index 395b393..1e66834 100644
--- a/src/NHamcrest.Tests/TestClasses/NestedClass.cs
+++ b/src/NHamcrest.Tests/TestClasses/NestedClass.cs
@@ -3,6 +3,7 @@
public class NestedClass
{
public decimal SomeNumber { get; set; }
+
public SimpleFlatClass InnerClass { get; set; }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.Tests/TestClasses/SimpleFlatClass.cs b/src/NHamcrest.Tests/TestClasses/SimpleFlatClass.cs
index d5bc22c..4ddf50e 100644
--- a/src/NHamcrest.Tests/TestClasses/SimpleFlatClass.cs
+++ b/src/NHamcrest.Tests/TestClasses/SimpleFlatClass.cs
@@ -3,18 +3,21 @@
public class SimpleFlatClass : ISimpleFlatClass
{
public int IntProperty { get; set; }
+
public string StringProperty { get; set; }
}
public interface ISimpleFlatClass
{
int IntProperty { get; }
+
string StringProperty { get; }
}
public class AnotherSimpleFlatClass : ISimpleFlatClass
{
public int IntProperty { get; set; }
+
public string StringProperty { get; set; }
}
}
\ No newline at end of file
diff --git a/src/NHamcrest.XUnit.Examples/NHamcrest.XUnit.Examples.csproj b/src/NHamcrest.XUnit.Examples/NHamcrest.XUnit.Examples.csproj
index e45ea57..7e654b5 100644
--- a/src/NHamcrest.XUnit.Examples/NHamcrest.XUnit.Examples.csproj
+++ b/src/NHamcrest.XUnit.Examples/NHamcrest.XUnit.Examples.csproj
@@ -4,7 +4,7 @@
net7.0
-
+
all