コード例 #1
0
        public void CustomizeNullFixtureThrows()
        {
            // Arrange
            var sut = new MultipleCustomization();

            // Act & assert
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Customize(null));
        }
コード例 #2
0
        public void CustomizeNullFixtureThrows()
        {
            // Fixture setup
            var sut = new MultipleCustomization();

            // Exercise system and verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Customize(null));
            // Teardown
        }
コード例 #3
0
        public void CustomizeAddsRelayToFixture(Type relayType)
        {
            // Arrange
            var sut     = new MultipleCustomization();
            var fixture = new Fixture();

            // Act
            sut.Customize(fixture);
            // Assert
            Assert.Contains(fixture.ResidueCollectors, relayType.IsInstanceOfType);
        }
コード例 #4
0
        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
        }
コード例 #5
0
        public void CustomizeAddsRelayToFixture(Type relayType)
        {
            // Fixture setup
            var sut     = new MultipleCustomization();
            var fixture = new Fixture();

            // Exercise system
            sut.Customize(fixture);
            // Verify outcome
            Assert.Contains(fixture.ResidueCollectors, relayType.IsInstanceOfType);
            // Teardown
        }
コード例 #6
0
        public void CustomizeAddsBuilderForProperConcreteMultipleType(Type specificationType, Type queryType)
        {
            // Arrange
            var sut     = new MultipleCustomization();
            var fixture = new Fixture();

            // Act
            sut.Customize(fixture);
            // Assert
            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());
        }
コード例 #7
0
        public void CustomizeAddsBuilderForConcreteDictionaries()
        {
            // Arrange
            var sut     = new MultipleCustomization();
            var fixture = new Fixture();

            // Act
            sut.Customize(fixture);
            // Assert
            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.Command is DictionaryFiller)
                        .Where(p => typeof(MethodInvoker).IsAssignableFrom(p.Builder.GetType()))
                        .Select(p => (MethodInvoker)p.Builder)
                        .Where(i => typeof(ModestConstructorQuery).IsAssignableFrom(i.Query.GetType()))
                        .Any());
        }
コード例 #8
0
        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
        }