public void VerifyTypeCorrectlyVerifies( CompositeIdiomaticAssertion sut, Type type) { sut.Verify(type); foreach (var assertion in sut.Assertions) assertion.ToMock().Verify(x => x.Verify(type)); }
public void VerifyMemberCorrectlyVerifies( CompositeIdiomaticAssertion sut, MemberInfo member) { sut.Verify(member); foreach (var assertion in sut.Assertions) assertion.ToMock().Verify(x => x.Verify(member)); }
public void VerifyAssemblyCorrectlyVerifies( CompositeIdiomaticAssertion sut, Assembly assembly) { sut.Verify(assembly); foreach (var assertion in sut.Assertions) assertion.ToMock().Verify(x => x.Verify(assembly)); }
public void VerifyEnumerableAssemblyVerifiesAllIdiomaticAssertions() { // Arrange var observedAssemblies = new List <IEnumerable <Assembly> >(); var expectations = Enumerable.Repeat( new DelegatingIdiomaticAssertion { OnAssembliesVerify = observedAssemblies.Add }, 3) .ToArray(); var sut = new CompositeIdiomaticAssertion(expectations); var assemblies = new[] { typeof(AbstractType).Assembly, typeof(string).Assembly, } .AsEnumerable(); // Act sut.Verify(assemblies); // Assert Assert.Equal(expectations.Length, observedAssemblies.Count(assemblies.Equals)); }
public void VerifyEnumerableFieldInfoVerifiesAllIdiomaticAssertions() { // Fixture setup var observedFields = new List <IEnumerable <FieldInfo> >(); var expectations = Enumerable.Repeat( new DelegatingIdiomaticAssertion { OnFieldInfosVerify = observedFields.Add }, 3) .ToArray(); var sut = new CompositeIdiomaticAssertion(expectations); IEnumerable <FieldInfo> fields = new[] { typeof(FieldHolder <object>).GetFields().First(), typeof(System.String).GetFields().First(), } .AsEnumerable(); // Exercise system sut.Verify(fields); // Verify outcome Assert.Equal(expectations.Length, observedFields.Count(fields.Equals)); // Teardown }
public void VerifyEnumerablePropertyInfoVerifiesAllIdiomaticAssertions() { // Fixture setup var observedProperties = new List <IEnumerable <PropertyInfo> >(); var expectations = Enumerable.Repeat( new DelegatingIdiomaticAssertion { OnPropertyInfosVerify = observedProperties.Add }, 3) .ToArray(); var sut = new CompositeIdiomaticAssertion(expectations); IEnumerable <PropertyInfo> properties = new[] { typeof(AbstractType).GetProperties().First(), typeof(System.String).GetProperties().First(), } .AsEnumerable(); // Exercise system sut.Verify(properties); // Verify outcome Assert.Equal(expectations.Length, observedProperties.Count(properties.Equals)); // Teardown }
public void VerifyEnumerableConstructorInfoVerifiesAllIdiomaticAssertions() { // Fixture setup var observedConstructors = new List <IEnumerable <ConstructorInfo> >(); var expectations = Enumerable.Repeat( new DelegatingIdiomaticAssertion { OnConstructorInfosVerify = observedConstructors.Add }, 3) .ToArray(); var sut = new CompositeIdiomaticAssertion(expectations); IEnumerable <ConstructorInfo> ctors = new[] { typeof(ConcreteType).GetConstructors().First(), typeof(System.String).GetConstructors().First(), } .AsEnumerable(); // Exercise system sut.Verify(ctors); // Verify outcome Assert.Equal(expectations.Length, observedConstructors.Count(ctors.Equals)); // Teardown }
public void VerifyEnumerableTypesVerifiesAllIdiomaticAssertions() { // Fixture setup var observedTypes = new List <IEnumerable <Type> >(); var expectations = Enumerable.Repeat( new DelegatingIdiomaticAssertion { OnTypesVerify = observedTypes.Add }, 3) .ToArray(); var sut = new CompositeIdiomaticAssertion(expectations); var assemblies = new[] { typeof(AbstractType), typeof(System.String), } .AsEnumerable(); // Exercise system sut.Verify(assemblies); // Verify outcome Assert.Equal(expectations.Length, observedTypes.Count(assemblies.Equals)); // Teardown }
public void VerifyEnumerableMethodInfoVerifiesAllIdiomaticAssertions() { // Fixture setup var observedMethods = new List <IEnumerable <MethodInfo> >(); var expectations = Enumerable.Repeat( new DelegatingIdiomaticAssertion { OnMethodInfosVerify = observedMethods.Add }, 3) .ToArray(); var sut = new CompositeIdiomaticAssertion(expectations); IEnumerable <MethodInfo> methods = new[] { typeof(Ploeh.TestTypeFoundation.AbstractType).GetMethods().First(), typeof(System.String).GetMethods().First(), } .AsEnumerable(); // Exercise system sut.Verify(methods); // Verify outcome Assert.Equal(expectations.Length, observedMethods.Count(methods.Equals)); // Teardown }
private static void VerifyCompositeAssertion(CompositeIdiomaticAssertion compositeAssertion) { compositeAssertion.Verify(typeof(T)); compositeAssertion.Verify(typeof(T).GetEqualsMethod()); compositeAssertion.Verify(typeof(T).GetMethod("GetHashCode")); }
public void SutIsIdiomaticAssertion(CompositeIdiomaticAssertion sut) { Assert.IsAssignableFrom<IIdiomaticAssertion>(sut); }