public void CanAppendDuplicateToBuilderAndDeDuplicate()
        {
            TestCollectionBuilder builder = _composition.WithCollectionBuilder <TestCollectionBuilder>();

            builder.Append <Resolved1>();
            builder.Append <Resolved1>();

            IServiceProvider factory = _composition.CreateServiceProvider();

            TestCollection col = builder.CreateCollection(factory);

            AssertCollection(col, typeof(Resolved1));
        }
        public void CanAppendToBuilder()
        {
            TestCollectionBuilder builder = _composition.WithCollectionBuilder <TestCollectionBuilder>();

            builder.Append <Resolved1>();
            builder.Append <Resolved2>();

            Assert.IsTrue(builder.Has <Resolved1>());
            Assert.IsTrue(builder.Has <Resolved2>());
            Assert.IsFalse(builder.Has <Resolved3>());

            IServiceProvider factory = _composition.CreateServiceProvider();
            TestCollection   col     = builder.CreateCollection(factory);

            AssertCollection(col, typeof(Resolved1), typeof(Resolved2));
        }
        public void CannotAppendInvalidTypeToBUilder()
        {
            TestCollectionBuilder builder = _composition.WithCollectionBuilder <TestCollectionBuilder>();

            ////builder.Append<Resolved4>(); // does not compile
            Assert.Throws <InvalidOperationException>(() => builder.Append(new[] { typeof(Resolved4) }));
        }
        public void CannotAppendToBuilderOnceCollectionIsCreated()
        {
            TestCollectionBuilder builder = _composition.WithCollectionBuilder <TestCollectionBuilder>();

            IServiceProvider factory = _composition.CreateServiceProvider();
            TestCollection   col     = builder.CreateCollection(factory);

            Assert.Throws <InvalidOperationException>(() => builder.Append <Resolved1>());
        }