コード例 #1
0
        public void TestableSutIsSut()
        {
            // Arrange
            // Act
            var sut = new DelegatingIdiomaticAssertion();

            // Assert
            Assert.IsAssignableFrom <IdiomaticAssertion>(sut);
        }
コード例 #2
0
        public void VerifyNullAssemblyThrows()
        {
            // Arrange
            var sut = new DelegatingIdiomaticAssertion();

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Verify((Assembly)null));
        }
コード例 #3
0
        public void VerifyNullPropertyInfoArrayThrows()
        {
            // Arrange
            var sut = new DelegatingIdiomaticAssertion();

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Verify((PropertyInfo[])null));
        }
コード例 #4
0
        public void VerifyConstructorInfoDoesNotThrow(Type type)
        {
            // Arrange
            var ctor = type.GetConstructors().First();
            var sut  = new DelegatingIdiomaticAssertion();

            // Act & Assert
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(ctor)));
        }
コード例 #5
0
        public void VerifyNullAssemblyThrows()
        {
            // Fixture setup
            var sut = new DelegatingIdiomaticAssertion();

            // Exercise system and verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Verify((Assembly)null));
            // Teardown
        }
コード例 #6
0
        public void VerifyFieldInfoDoesNotThrow(Type type)
        {
            // Arrange
            var field = type.GetFields().First();
            var sut   = new DelegatingIdiomaticAssertion();

            // Act & Assert
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(field)));
        }
コード例 #7
0
        public void VerifyMethodInfoDoesNotThrow(Type type)
        {
            // Arrange
            var method = type.GetMethods().Except(type.GetProperties().SelectMany(p => p.GetAccessors())).First();
            var sut    = new DelegatingIdiomaticAssertion();

            // Act & Assert
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(method)));
        }
コード例 #8
0
        public void VerifyPropertyInfoDoesNotThrow(Type type)
        {
            // Arrange
            var property = type.GetProperties().First();
            var sut      = new DelegatingIdiomaticAssertion();

            // Act & Assert
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(property)));
        }
コード例 #9
0
        public void TestableSutIsSut()
        {
            // Fixture setup
            // Exercise system
            var sut = new DelegatingIdiomaticAssertion();

            // Verify outcome
            Assert.IsAssignableFrom <IdiomaticAssertion>(sut);
            // Teardown
        }
コード例 #10
0
        public void VerifyPropertyInfoDoesNotThrow(Type type)
        {
            // Fixture setup
            var property = type.GetProperties().First();
            var sut      = new DelegatingIdiomaticAssertion();

            // Exercise system and verify outcome
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(property)));
            // Teardown
        }
コード例 #11
0
        public void VerifyMethodInfoDoesNotThrow(Type type)
        {
            // Fixture setup
            var method = type.GetMethods().Except(type.GetProperties().SelectMany(p => p.GetAccessors())).First();
            var sut    = new DelegatingIdiomaticAssertion();

            // Exercise system and verify outcome
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(method)));
            // Teardown
        }
コード例 #12
0
        public void VerifyConstructorInfoDoesNotThrow(Type type)
        {
            // Fixture setup
            var ctor = type.GetConstructors().First();
            var sut  = new DelegatingIdiomaticAssertion();

            // Exercise system and verify outcome
            Assert.Null(Record.Exception(() =>
                                         sut.Verify(ctor)));
            // Teardown
        }
コード例 #13
0
        public void VerifyTypeCorrectlyInvokesConstructorsVerify(Type type)
        {
            // Arrange
            var expectedCtors = type.GetConstructors();
            var mockVerified  = false;
            var sut           = new DelegatingIdiomaticAssertion {
                OnConstructorInfoArrayVerify = c => mockVerified = expectedCtors.IsEquivalentTo(c)
            };

            // Act
            sut.Verify(type);
            // Assert
            Assert.True(mockVerified, "Mock verified.");
        }
コード例 #14
0
        public void VerifyTypeCorrectlyInvokesMethodsVerify(Type type)
        {
            // Arrange
            var expectedMethods = type.GetMethods().Except(type.GetProperties().SelectMany(p => p.GetAccessors()));
            var mockVerified    = false;
            var sut             = new DelegatingIdiomaticAssertion {
                OnMethodInfosVerify = m => mockVerified = expectedMethods.IsEquivalentTo(m)
            };

            // Act
            sut.Verify(type);
            // Assert
            Assert.True(mockVerified, "Mock verified.");
        }
コード例 #15
0
        public void VerifyTypeCorrectlyInvokesFieldsVerify(Type type)
        {
            // Arrange
            var expectedFields = type.GetFields();
            var mockVerified   = false;
            var sut            = new DelegatingIdiomaticAssertion {
                OnFieldInfoArrayVerify = p => mockVerified = expectedFields.IsEquivalentTo(p)
            };

            // Act
            sut.Verify(type);
            // Assert
            Assert.True(mockVerified, "Mock verified.");
        }
コード例 #16
0
        public void VerifyConstructorInfosCorrectlyInvokesNextVerify(Type type)
        {
            // Arrange
            var ctors = type.GetConstructors().AsEnumerable();
            var observedConstructors = new List <ConstructorInfo>();
            var sut = new DelegatingIdiomaticAssertion {
                OnConstructorInfoVerify = observedConstructors.Add
            };

            // Act
            sut.Verify(ctors);
            // Assert
            Assert.True(ctors.SequenceEqual(observedConstructors));
        }
コード例 #17
0
        public void VerifyPropertyInfosCorrectlyInvokesNextVerify(Type type)
        {
            // Arrange
            var properties         = type.GetProperties().AsEnumerable();
            var observedProperties = new List <PropertyInfo>();
            var sut = new DelegatingIdiomaticAssertion {
                OnPropertyInfoVerify = observedProperties.Add
            };

            // Act
            sut.Verify(properties);
            // Assert
            Assert.True(properties.SequenceEqual(observedProperties));
        }
コード例 #18
0
        public void VerifyMethodInfosCorrectlyInvokesNextVerify(Type type)
        {
            // Arrange
            var methods         = type.GetMethods().Except(type.GetProperties().SelectMany(p => p.GetAccessors()));
            var observedMethods = new List <MethodInfo>();
            var sut             = new DelegatingIdiomaticAssertion {
                OnMethodInfoVerify = observedMethods.Add
            };

            // Act
            sut.Verify(methods);
            // Assert
            Assert.True(methods.SequenceEqual(observedMethods));
        }
コード例 #19
0
        public void VerifyFieldInfosCorrectlyInvokesNextVerify(Type type)
        {
            // Arrange
            var fields         = type.GetFields().Select(f => f);
            var observedFields = new List <FieldInfo>();
            var sut            = new DelegatingIdiomaticAssertion {
                OnFieldInfoVerify = observedFields.Add
            };

            // Act
            sut.Verify(fields);
            // Assert
            Assert.True(fields.SequenceEqual(observedFields));
        }
コード例 #20
0
        public void VerifyMemberInfoCorrectlyInvokesFieldInfoVerify(Type type)
        {
            // Arrange
            var member       = type.GetFields().Cast <MemberInfo>().First();
            var mockVerified = false;
            var sut          = new DelegatingIdiomaticAssertion {
                OnFieldInfoVerify = f => mockVerified = f.Equals(member)
            };

            // Act
            sut.Verify(member);
            // Assert
            Assert.True(mockVerified, "Mock verified.");
        }
コード例 #21
0
        public void VerifyMembersCorrectlyInvokesNextVerify(Type type)
        {
            // Arrange
            var members         = type.GetMembers().AsEnumerable();
            var observedMembers = new List <MemberInfo>();
            var sut             = new DelegatingIdiomaticAssertion {
                OnMemberInfoVerify = observedMembers.Add
            };

            // Act
            sut.Verify(members);
            // Assert
            Assert.True(members.SequenceEqual(observedMembers));
        }
コード例 #22
0
        public void VerifyMemberInfoArrayCorrectlyInvokesNextVerify(Type type)
        {
            // Fixture setup
            var members         = type.GetMembers();
            var observedMembers = new List <MemberInfo>();
            var sut             = new DelegatingIdiomaticAssertion {
                OnMemberInfoVerify = observedMembers.Add
            };

            // Exercise system
            sut.Verify(members);
            // Verify outcome
            Assert.True(members.SequenceEqual(observedMembers));
            // Teardown
        }
コード例 #23
0
        public void VerifyConstructorInfosCorrectlyInvokesNextVerify(Type type)
        {
            // Fixture setup
            var ctors = type.GetConstructors().AsEnumerable();
            var observedConstructors = new List <ConstructorInfo>();
            var sut = new DelegatingIdiomaticAssertion {
                OnConstructorInfoVerify = observedConstructors.Add
            };

            // Exercise system
            sut.Verify(ctors);
            // Verify outcome
            Assert.True(ctors.SequenceEqual(observedConstructors));
            // Teardown
        }
コード例 #24
0
        public void VerifyAssembliesCorrectlyInvokesNextVerify()
        {
            // Arrange
            var assemblies = new[] { typeof(IdiomaticAssertion).GetType().Assembly, this.GetType().Assembly, typeof(Fixture).GetType().Assembly }.AsEnumerable();

            var observedAssemblies = new List <Assembly>();
            var sut = new DelegatingIdiomaticAssertion {
                OnAssemblyVerify = observedAssemblies.Add
            };

            // Act
            sut.Verify(assemblies);
            // Assert
            Assert.True(assemblies.SequenceEqual(observedAssemblies));
        }
コード例 #25
0
        public void VerifyFieldInfosCorrectlyInvokesNextVerify(Type type)
        {
            // Fixture setup
            var fields         = type.GetFields().Select(f => f);
            var observedFields = new List <FieldInfo>();
            var sut            = new DelegatingIdiomaticAssertion {
                OnFieldInfoVerify = observedFields.Add
            };

            // Exercise system
            sut.Verify(fields);
            // Verify outcome
            Assert.True(fields.SequenceEqual(observedFields));
            // Teardown
        }
コード例 #26
0
        public void VerifyMethodInfosCorrectlyInvokesNextVerify(Type type)
        {
            // Fixture setup
            var methods         = type.GetMethods().Except(type.GetProperties().SelectMany(p => p.GetAccessors()));
            var observedMethods = new List <MethodInfo>();
            var sut             = new DelegatingIdiomaticAssertion {
                OnMethodInfoVerify = observedMethods.Add
            };

            // Exercise system
            sut.Verify(methods);
            // Verify outcome
            Assert.True(methods.SequenceEqual(observedMethods));
            // Teardown
        }
コード例 #27
0
        public void VerifyPropertyInfosCorrectlyInvokesNextVerify(Type type)
        {
            // Fixture setup
            var properties         = type.GetProperties().AsEnumerable();
            var observedProperties = new List <PropertyInfo>();
            var sut = new DelegatingIdiomaticAssertion {
                OnPropertyInfoVerify = observedProperties.Add
            };

            // Exercise system
            sut.Verify(properties);
            // Verify outcome
            Assert.True(properties.SequenceEqual(observedProperties));
            // Teardown
        }
コード例 #28
0
        public void VerifyTypesCorrectlyInvokesNextVerify()
        {
            // Arrange
            var types = new[] { typeof(string), typeof(int), typeof(Version) }.AsEnumerable();

            var observedTypes = new List <Type>();
            var sut           = new DelegatingIdiomaticAssertion {
                OnTypeVerify = observedTypes.Add
            };

            // Act
            sut.Verify(types);
            // Assert
            Assert.True(types.SequenceEqual(observedTypes));
        }
コード例 #29
0
        public void VerifyMemberInfoCorrectlyInvokesFieldInfoVerify(Type type)
        {
            // Fixture setup
            var member       = type.GetFields().Cast <MemberInfo>().First();
            var mockVerified = false;
            var sut          = new DelegatingIdiomaticAssertion {
                OnFieldInfoVerify = f => mockVerified = f.Equals(member)
            };

            // Exercise system
            sut.Verify(member);
            // Verify outcome
            Assert.True(mockVerified, "Mock verified.");
            // Teardown
        }
コード例 #30
0
        public void VerifyTypeCorrectlyInvokesFieldsVerify(Type type)
        {
            // Fixture setup
            var expectedFields = type.GetFields();
            var mockVerified   = false;
            var sut            = new DelegatingIdiomaticAssertion {
                OnFieldInfoArrayVerify = p => mockVerified = expectedFields.IsEquivalentTo(p)
            };

            // Exercise system
            sut.Verify(type);
            // Verify outcome
            Assert.True(mockVerified, "Mock verified.");
            // Teardown
        }