Ejemplo n.º 1
0
        public void ShouldCorrectlyCalculateHashCode()
        {
            var fixture = new Fixture();

            var calculatesHashCodeAssertion = new GetHashCodeSuccessiveAssertion(fixture);

            calculatesHashCodeAssertion.Verify(ValueTypes());
        }
        public void VerifyIllbehavedEqualsSelfBehaviourThrows()
        {
            // Arrange
            var dummyComposer = new Fixture();
            var sut           = new GetHashCodeSuccessiveAssertion(dummyComposer);

            // Act & Assert
            Assert.Throws <GetHashCodeOverrideException>(() =>
                                                         sut.Verify(typeof(IllBehavedEqualsSelfObjectOverride)));
        }
        public void VerifyClassThatDoesNotOverrideObjectGetHashCodeDoesNothing()
        {
            // Arrange
            var dummyComposer = new Fixture();
            var sut           = new GetHashCodeSuccessiveAssertion(dummyComposer);

            // Act & Assert
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(typeof(ClassThatDoesNotOverrideObjectGetHashCode))));
        }
        public void VerifyWellBehavedGetHashCodeSelfOverrideDoesNotThrow()
        {
            // Arrange
            var dummyComposer = new Fixture();
            var sut           = new GetHashCodeSuccessiveAssertion(dummyComposer);

            // Act & Assert
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(typeof(WellBehavedGetHashCodeSelfObjectOverride))));
        }
        public void VerifyNullMethodThrows()
        {
            // Arrange
            var dummyComposer = new Fixture();
            var sut           = new GetHashCodeSuccessiveAssertion(dummyComposer);

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Verify((MethodInfo)null));
        }
Ejemplo n.º 6
0
        public void VerifyIllbehavedEqualsSelfBehaviourThrows()
        {
            // Fixture setup
            var dummyComposer = new Fixture();
            var sut           = new GetHashCodeSuccessiveAssertion(dummyComposer);

            // Exercise system and verify outcome
            Assert.Throws <GetHashCodeOverrideException>(() =>
                                                         sut.Verify(typeof(IllBehavedEqualsSelfObjectOverride)));
            // Teardown
        }
Ejemplo n.º 7
0
        public void VerifyWellBehavedGetHashCodeSelfOverrideDoesNotThrow()
        {
            // Fixture setup
            var dummyComposer = new Fixture();
            var sut           = new GetHashCodeSuccessiveAssertion(dummyComposer);

            // Exercise system and verify outcome
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(typeof(WellBehavedGetHashCodeSelfObjectOverride))));
            // Teardown
        }
Ejemplo n.º 8
0
        public void VerifyClassThatDoesNotOverrideObjectGetHashCodeDoesNothing()
        {
            // Fixture setup
            var dummyComposer = new Fixture();
            var sut           = new GetHashCodeSuccessiveAssertion(dummyComposer);

            // Exercise system and verify outcome
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(typeof(ClassThatDoesNotOverrideObjectGetHashCode))));
            // Teardown
        }
Ejemplo n.º 9
0
        public void VerifyNullMethodThrows()
        {
            // Fixture setup
            var dummyComposer = new Fixture();
            var sut           = new GetHashCodeSuccessiveAssertion(dummyComposer);

            // Exercise system and verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Verify((MethodInfo)null));
            // Teardown
        }