public void DifferentValues() { ((Action)(() => ValueTypeAssertions.HasValueEquality(new AStruct(1), new AStruct(2)))).Should().Throw <AssertFailedException>(); ((Action)(() => ValueTypeAssertions.HasValueInequality(new AStruct(1), new AStruct(2)))).Should().NotThrow(); ((Action)(() => ValueTypeAssertions.HasValueInequality(new AStruct(1), new AStruct()))).Should().NotThrow(); ((Action)(() => ValueTypeAssertions.HasValueInequality(new AStruct(), new AStruct(2)))).Should().NotThrow(); }
public void Int() { ((Action)(() => ValueTypeAssertions.HasValueEquality(1, 1))).Should().NotThrow(); ((Action)(() => ValueTypeAssertions.HasValueEquality(1, 2))).Should().Throw <AssertFailedException>(); ((Action)(() => ValueTypeAssertions.HasValueInequality(2, 1))).Should().NotThrow(); ((Action)(() => ValueTypeAssertions.HasValueInequality(2, 2))).Should().Throw <AssertFailedException>(); }
public void Passing_the_same_object_twice_is_an_error() { var anObject = new C(42); ((Action)(() => ValueTypeAssertions.HasValueEquality(anObject, anObject))) .Should().Throw <AssertFailedException>() .And.Message.Should().Contain("Pass two different references to compare."); }
public void EqualValues() { ((Action)(() => ValueTypeAssertions.HasValueEquality(new C(1), new C(1)))) .Should().Throw <AssertFailedException>() .And.Message.Should().Contain("IEquatable<>.Equals"); }
public void EqualValues() { ((Action)(() => ValueTypeAssertions.HasValueEquality(new AClass(1), new AClass(1)))) .Should().Throw <AssertFailedException>() .And.Message.Should().Contain("Equals(object null)"); }
public void EqualValues() { ((Action)(() => ValueTypeAssertions.HasValueEquality(new AClass(1), new AClass(1)))).Should().NotThrow(); ((Action)(() => ValueTypeAssertions.HasValueInequality(new AClass(1), new AClass(1)))).Should().Throw <AssertFailedException>(); }
public void EqualValues() { ((Action)(() => ValueTypeAssertions.HasValueEquality(new AClass(1), new AClass(1)))) .Should().Throw <AssertFailedException>() .And.Message.Should().Contain("compare to other type"); }
public void EqualValues() { ((Action)(() => ValueTypeAssertions.HasValueEquality(new C("foo"), new C("FOO")))) .Should().NotThrow(); }
public void String() { ((Action)(() => ValueTypeAssertions.HasValueEquality("foo", "bar"))).Should().Throw <AssertFailedException>(); ((Action)(() => ValueTypeAssertions.HasValueInequality("foo", "foo"))).Should().Throw <AssertFailedException>(); }
public void ShouldFail() { ((Action)(() => ValueTypeAssertions.HasValueEquality(new C("foo"), new C("FOO")))) .Should().Throw <AssertFailedException>() .And.Message.Should().Contain("GetHashCode"); }