public void Source_WithNameForNoAction_ShouldEmpty()
        {
            var sut = new ObjectFactoryConfigurationSource();

            sut.For<Customer, IDoSomething>("Group", x => {});

            var configuration = sut.Source();

            configuration.ShouldNotBeNull();

            configuration.Items.ShouldBeEmpty();
        }
        public void Source_WithForCreate_ShouldBeOne()
        {
            var sut = new ObjectFactoryConfigurationSource();

            sut.For<Customer, IDoSomething>().Create<DoSomething>();

            var configuration = sut.Source();

            configuration.ShouldNotBeNull();

            configuration.Items.ShouldNotBeNull();

            configuration.Items.Count.ShouldBe(1);

            configuration.Items[0].TargetType.ShouldBe(typeof(Customer));

            configuration.Items[0].ResultType.ShouldBe(typeof(DoSomething));

            configuration.Items[0].Selector.ShouldBeNull();
        }
        public void Source_WithNameForNullAction_ShouldThorwException()
        {
            var sut = new ObjectFactoryConfigurationSource();

            Should.Throw<Exception>(() => sut.For<Customer, IDoSomething>("Group", null));
        }
        public void Source_WithNameForCreateWhen_ShouldBeOne()
        {
            var sut = new ObjectFactoryConfigurationSource();

            Func<Customer, bool> when = x => x.Active;

            sut.For<Customer, IDoSomething>("Group", x => x.Create<DoSomething>().When(when));

            var configuration = sut.Source();

            configuration.ShouldNotBeNull();

            configuration.Items.ShouldNotBeNull();

            configuration.Items.Count.ShouldBe(1);

            configuration.Items[0].Name = "Group";

            configuration.Items[0].TargetType.ShouldBe(typeof(Customer));

            configuration.Items[0].ResultType.ShouldBe(typeof(DoSomething));

            configuration.Items[0].Selector.ShouldBe(when);
        }