예제 #1
0
 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();
 }
예제 #2
0
 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.");
        }
예제 #4
0
 public void EqualValues()
 {
     ((Action)(() => ValueTypeAssertions.HasValueEquality(new C(1), new C(1))))
     .Should().Throw <AssertFailedException>()
     .And.Message.Should().Contain("IEquatable<>.Equals");
 }
예제 #5
0
 public void EqualValues()
 {
     ((Action)(() => ValueTypeAssertions.HasValueEquality(new AClass(1), new AClass(1))))
     .Should().Throw <AssertFailedException>()
     .And.Message.Should().Contain("Equals(object null)");
 }
예제 #6
0
 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>();
 }
예제 #7
0
 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();
 }
예제 #9
0
 public void String()
 {
     ((Action)(() => ValueTypeAssertions.HasValueEquality("foo", "bar"))).Should().Throw <AssertFailedException>();
     ((Action)(() => ValueTypeAssertions.HasValueInequality("foo", "foo"))).Should().Throw <AssertFailedException>();
 }
예제 #10
0
 public void ShouldFail()
 {
     ((Action)(() => ValueTypeAssertions.HasValueEquality(new C("foo"), new C("FOO"))))
     .Should().Throw <AssertFailedException>()
     .And.Message.Should().Contain("GetHashCode");
 }