public void CustomizeNullFixtureThrows() { // Fixture setup var sut = new MultipleCustomization(); // Exercise system and verify outcome Assert.Throws<ArgumentNullException>(() => sut.Customize(null)); // Teardown }
public void SutIsCustomization() { // Fixture setup // Exercise system var sut = new MultipleCustomization(); // Verify outcome Assert.IsAssignableFrom<ICustomization>(sut); // Teardown }
public void CustomizeAddsRelayToFixture(Type relayType) { // Fixture setup var sut = new MultipleCustomization(); var fixture = new Fixture(); // Exercise system sut.Customize(fixture); // Verify outcome Assert.True(fixture.ResidueCollectors.Any(b => relayType.IsAssignableFrom(b.GetType()))); // Teardown }
public void CustomizeAddsBuilderForProperConcreteMultipleType(Type specificationType, Type queryType) { // Fixture setup var sut = new MultipleCustomization(); var fixture = new Fixture(); // Exercise system sut.Customize(fixture); // Verify outcome Assert.True(fixture.Customizations .OfType<FilteringSpecimenBuilder>() .Where(b => specificationType.IsAssignableFrom(b.Specification.GetType())) .Where(b => typeof(MethodInvoker).IsAssignableFrom(b.Builder.GetType())) .Select(b => (MethodInvoker)b.Builder) .Where(i => queryType.IsAssignableFrom(i.Query.GetType())) .Any()); // Teardown }
public void CustomizeAddsBuilderForConcreteDictionaries() { // Fixture setup var sut = new MultipleCustomization(); var fixture = new Fixture(); // Exercise system sut.Customize(fixture); // Verify outcome Assert.True(fixture.Customizations .OfType<FilteringSpecimenBuilder>() .Where(b => typeof(DictionarySpecification).IsAssignableFrom(b.Specification.GetType())) .Where(b => typeof(Postprocessor).IsAssignableFrom(b.Builder.GetType())) .Select(b => (Postprocessor)b.Builder) .Where(p => p.Action == DictionaryFiller.AddMany) .Where(p => typeof(MethodInvoker).IsAssignableFrom(p.Builder.GetType())) .Select(p => (MethodInvoker)p.Builder) .Where(i => typeof(ModestConstructorQuery).IsAssignableFrom(i.Query.GetType())) .Any()); // Teardown }