コード例 #1
0
 public void TestableSutIsSut()
 {
     // Fixture setup
     // Exercise system
     var sut = new DelegatingIdiomaticAssertion();
     // Verify outcome
     Assert.IsAssignableFrom<IdiomaticAssertion>(sut);
     // Teardown
 }
コード例 #2
0
 public void VerifyNullAssemblyThrows()
 {
     // Fixture setup
     var sut = new DelegatingIdiomaticAssertion();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.Verify((Assembly)null));
     // Teardown
 }
コード例 #3
0
        public void TestableSutIsSut()
        {
            // Fixture setup
            // Exercise system
            var sut = new DelegatingIdiomaticAssertion();

            // Verify outcome
            Assert.IsAssignableFrom <IdiomaticAssertion>(sut);
            // Teardown
        }
コード例 #4
0
        public void VerifyNullAssemblyThrows()
        {
            // Fixture setup
            var sut = new DelegatingIdiomaticAssertion();

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

            // Exercise system and verify outcome
            Assert.DoesNotThrow(() =>
                                sut.Verify(field));
            // Teardown
        }
コード例 #6
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.DoesNotThrow(() =>
                                sut.Verify(method));
            // Teardown
        }
コード例 #7
0
        public void VerifyPropertyInfoDoesNotThrow(Type type)
        {
            // Fixture setup
            var property = type.GetProperties().First();
            var sut      = new DelegatingIdiomaticAssertion();

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

            // Exercise system and verify outcome
            Assert.DoesNotThrow(() =>
                                sut.Verify(ctor));
            // Teardown
        }
コード例 #9
0
        public void VerifyAssembliesCorrectlyInvokesNextVerify()
        {
            // Fixture setup
            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 };
            // Exercise system
            sut.Verify(assemblies);
            // Verify outcome
            Assert.True(assemblies.SequenceEqual(observedAssemblies));
            // Teardown
        }
コード例 #10
0
        public void VerifyAssemblyCorrectlyInvokesNextVerify()
        {
            // Fixture setup
            var assembly = this.GetType().Assembly;
            var expectedTypes = assembly.GetExportedTypes();

            var mockVerified = false;
            var sut = new DelegatingIdiomaticAssertion { OnTypeArrayVerify = t => mockVerified = expectedTypes.SequenceEqual(t) };
            // Exercise system
            sut.Verify(assembly);
            // Verify outcome
            Assert.True(mockVerified, "Mock verified.");
            // Teardown
        }
コード例 #11
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
        }
コード例 #12
0
        public void VerifyTypeCorrectlyInvokesMethodsVerify(Type type)
        {
            // Fixture setup
            var expectedMethods = type.GetMethods().Except(type.GetProperties().SelectMany(p => p.GetAccessors()));
            var mockVerified    = false;
            var sut             = new DelegatingIdiomaticAssertion {
                OnMethodInfosVerify = m => mockVerified = expectedMethods.IsEquivalentTo(m)
            };

            // Exercise system
            sut.Verify(type);
            // Verify outcome
            Assert.True(mockVerified, "Mock verified.");
            // Teardown
        }
コード例 #13
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
        }
コード例 #14
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
        }
コード例 #15
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
        }
コード例 #16
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
        }
コード例 #17
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
        }
コード例 #18
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
        }
コード例 #19
0
        public void VerifyTypesCorrectlyInvokesNextVerify()
        {
            // Fixture setup
            var types = new[] { typeof(string), typeof(int), typeof(Version) }.AsEnumerable();

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

            // Exercise system
            sut.Verify(types);
            // Verify outcome
            Assert.True(types.SequenceEqual(observedTypes));
            // Teardown
        }
コード例 #20
0
        public void VerifyAssembliesCorrectlyInvokesNextVerify()
        {
            // Fixture setup
            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
            };

            // Exercise system
            sut.Verify(assemblies);
            // Verify outcome
            Assert.True(assemblies.SequenceEqual(observedAssemblies));
            // Teardown
        }
コード例 #21
0
        public void VerifyStaticTypeCorrectlyInvokesMethodsVerify()
        {
            // Fixture setup
            Type type            = typeof(UnguardedStaticMethodOnStaticTypeHost);
            var  expectedMethods = new[] { type.GetMethod("Method") };
            var  mockVerified    = false;
            var  sut             = new DelegatingIdiomaticAssertion
            {
                OnMethodInfosVerify = m => mockVerified = expectedMethods.IsEquivalentTo(m)
            };

            // Exercise system
            sut.Verify(type);
            // Verify outcome
            Assert.True(mockVerified, "Mock verified.");
            // Teardown
        }
コード例 #22
0
        public void VerifyAssemblyCorrectlyInvokesNextVerify()
        {
            // Fixture setup
            var assembly      = this.GetType().Assembly;
            var expectedTypes = assembly.GetExportedTypes();

            var mockVerified = false;
            var sut          = new DelegatingIdiomaticAssertion {
                OnTypeArrayVerify = t => mockVerified = expectedTypes.SequenceEqual(t)
            };

            // Exercise system
            sut.Verify(assembly);
            // Verify outcome
            Assert.True(mockVerified, "Mock verified.");
            // Teardown
        }
コード例 #23
0
        public void VerifyMemberInfoCorrectlyInvokesMethodVerify(Type type)
        {
            // Fixture setup
            var member = type.GetMethods()
                         .Except(type.GetProperties().SelectMany(p => p.GetAccessors()))
                         .Cast <MemberInfo>()
                         .First();
            var mockVerified = false;
            var sut          = new DelegatingIdiomaticAssertion {
                OnMethodInfoVerify = m => mockVerified = m.Equals(member)
            };

            // Exercise system
            sut.Verify(member);
            // Verify outcome
            Assert.True(mockVerified, "Mock verified.");
            // Teardown
        }
コード例 #24
0
 public void VerifyTypeCorrectlyInvokesConstructorsVerify(Type type)
 {
     // Fixture setup
     var expectedCtors = type.GetConstructors();
     var mockVerified = false;
     var sut = new DelegatingIdiomaticAssertion { OnConstructorInfoArrayVerify = c => mockVerified = expectedCtors.IsEquivalentTo(c) };
     // Exercise system
     sut.Verify(type);
     // Verify outcome
     Assert.True(mockVerified, "Mock verified.");
     // Teardown
 }
コード例 #25
0
 public void VerifyPropertyInfoDoesNotThrow(Type type)
 {
     // Fixture setup
     var property = type.GetProperties().First();
     var sut = new DelegatingIdiomaticAssertion();
     // Exercise system and verify outcome
     Assert.DoesNotThrow(() =>
         sut.Verify(property));
     // Teardown
 }
コード例 #26
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
 }
コード例 #27
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.DoesNotThrow(() =>
         sut.Verify(method));
     // Teardown
 }
コード例 #28
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
 }
コード例 #29
0
 public void VerifyConstructorInfoDoesNotThrow(Type type)
 {
     // Fixture setup
     var ctor = type.GetConstructors().First();
     var sut = new DelegatingIdiomaticAssertion();
     // Exercise system and verify outcome
     Assert.DoesNotThrow(() =>
         sut.Verify(ctor));
     // Teardown
 }
コード例 #30
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
 }
コード例 #31
0
 public void VerifyMemberInfoCorrectlyInvokesPropertyVerify(Type type)
 {
     // Fixture setup
     var member = type.GetProperties().Cast<MemberInfo>().First();
     var mockVerified = false;
     var sut = new DelegatingIdiomaticAssertion { OnPropertyInfoVerify = p => mockVerified = p.Equals(member) };
     // Exercise system
     sut.Verify(member);
     // Verify outcome
     Assert.True(mockVerified, "Mock verified.");
     // Teardown
 }
コード例 #32
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
 }
コード例 #33
0
 public void VerifyFieldInfoDoesNotThrow(Type type)
 {
     // Fixture setup
     var field = type.GetFields().First();
     var sut = new DelegatingIdiomaticAssertion();
     // Exercise system and verify outcome
     Assert.DoesNotThrow(() =>
         sut.Verify(field));
     // Teardown
 }
コード例 #34
0
 public void VerifyMemberInfoCorrectlyInvokesMethodVerify(Type type)
 {
     // Fixture setup
     var member = type.GetMethods()
         .Except(type.GetProperties().SelectMany(p => p.GetAccessors()))
         .Cast<MemberInfo>()
         .First();
     var mockVerified = false;
     var sut = new DelegatingIdiomaticAssertion { OnMethodInfoVerify = m => mockVerified = m.Equals(member) };
     // Exercise system
     sut.Verify(member);
     // Verify outcome
     Assert.True(mockVerified, "Mock verified.");
     // Teardown
 }
コード例 #35
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
 }
コード例 #36
0
 public void VerifyTypeCorrectlyInvokesPropertiesVerify(Type type)
 {
     // Fixture setup
     var expectedProperties = type.GetProperties();
     var mockVerified = false;
     var sut = new DelegatingIdiomaticAssertion { OnPropertyInfoArrayVerify = p => mockVerified = expectedProperties.IsEquivalentTo(p) };
     // Exercise system
     sut.Verify(type);
     // Verify outcome
     Assert.True(mockVerified, "Mock verified.");
     // Teardown
 }
コード例 #37
0
 public void VerifyTypeCorrectlyInvokesMethodsVerify(Type type)
 {
     // Fixture setup
     var expectedMethods = type.GetMethods().Except(type.GetProperties().SelectMany(p => p.GetAccessors()));
     var mockVerified = false;
     var sut = new DelegatingIdiomaticAssertion { OnMethodInfosVerify = m => mockVerified = expectedMethods.IsEquivalentTo(m) };
     // Exercise system
     sut.Verify(type);
     // Verify outcome
     Assert.True(mockVerified, "Mock verified.");
     // Teardown
 }
コード例 #38
0
 public void VerifyStaticTypeCorrectlyInvokesMethodsVerify()
 {
     // Fixture setup
     Type type = typeof(UngardedStaticMethodOnStaticTypeHost);
     var expectedMethods = new[] { type.GetMethod("Method")};
     var mockVerified = false;
     var sut = new DelegatingIdiomaticAssertion
     {
         OnMethodInfosVerify = m => mockVerified = expectedMethods.IsEquivalentTo(m)
     };
     // Exercise system
     sut.Verify(type);
     // Verify outcome
     Assert.True(mockVerified, "Mock verified.");
     // Teardown
 }
コード例 #39
0
        public void VerifyTypesCorrectlyInvokesNextVerify()
        {
            // Fixture setup
            var types = new[] { typeof(string), typeof(int), typeof(Version) }.AsEnumerable();

            var observedTypes = new List<Type>();
            var sut = new DelegatingIdiomaticAssertion { OnTypeVerify = observedTypes.Add };
            // Exercise system
            sut.Verify(types);
            // Verify outcome
            Assert.True(types.SequenceEqual(observedTypes));
            // Teardown
        }