public void TestableSutIsSut() { // Fixture setup // Exercise system var sut = new DelegatingIdiomaticAssertion(); // Verify outcome Assert.IsAssignableFrom<IdiomaticAssertion>(sut); // Teardown }
public void VerifyNullAssemblyThrows() { // Fixture setup var sut = new DelegatingIdiomaticAssertion(); // Exercise system and verify outcome Assert.Throws<ArgumentNullException>(() => sut.Verify((Assembly)null)); // Teardown }
public void TestableSutIsSut() { // Fixture setup // Exercise system var sut = new DelegatingIdiomaticAssertion(); // Verify outcome Assert.IsAssignableFrom <IdiomaticAssertion>(sut); // Teardown }
public void VerifyNullAssemblyThrows() { // Fixture setup var sut = new DelegatingIdiomaticAssertion(); // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.Verify((Assembly)null)); // Teardown }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }