Beispiel #1
0
        public void ManyResolverContainsTypes()
        {
            var resolver = new ManyResolver(new Type[] { typeof(Resolved1), typeof(Resolved2) });

            Assert.IsTrue(resolver.ContainsType <Resolved1>());
            Assert.IsTrue(resolver.ContainsType <Resolved2>());
            Assert.IsFalse(resolver.ContainsType <Resolved3>());
            //Assert.IsFalse(resolver.ContainsType<Resolved4>()); // does not compile
        }
Beispiel #2
0
        public void ManyResolverCanClearBeforeFreeze()
        {
            var resolver = new ManyResolver();

            resolver.AddType <Resolved1>();
            resolver.AddType <Resolved2>();
            resolver.Clear();
            Assert.IsFalse(resolver.ContainsType <Resolved1>());
            Assert.IsFalse(resolver.ContainsType <Resolved2>());
        }
Beispiel #3
0
        public void ManyResolverCanInsertBeforeTypeBeforeFreeze()
        {
            var resolver = new ManyResolver(new Type[] { typeof(Resolved1), typeof(Resolved2) });

            resolver.InsertTypeBefore <Resolved2, Resolved3>();

            Assert.IsTrue(resolver.ContainsType <Resolved1>());
            Assert.IsTrue(resolver.ContainsType <Resolved2>());
            Assert.IsTrue(resolver.ContainsType <Resolved3>());
        }
Beispiel #4
0
        public void ManyResolverCanClearBeforeFreeze()
        {
            var resolver = new ManyResolver(new ActivatorServiceProvider(), Mock.Of <ILogger>());

            resolver.AddType <Resolved1>();
            resolver.AddType <Resolved2>();
            resolver.Clear();
            Assert.IsFalse(resolver.ContainsType <Resolved1>());
            Assert.IsFalse(resolver.ContainsType <Resolved2>());
        }
Beispiel #5
0
        public void ManyResolverCanInsertBeforeTypeBeforeFreeze()
        {
            var resolver = new ManyResolver(new ActivatorServiceProvider(), Mock.Of <ILogger>(), new Type[] { typeof(Resolved1), typeof(Resolved2) });

            resolver.InsertTypeBefore <Resolved2, Resolved3>();

            Assert.IsTrue(resolver.ContainsType <Resolved1>());
            Assert.IsTrue(resolver.ContainsType <Resolved2>());
            Assert.IsTrue(resolver.ContainsType <Resolved3>());
        }
Beispiel #6
0
        public void ManyResolverContainsTypes()
        {
            var resolver = new ManyResolver(
                new ActivatorServiceProvider(), Mock.Of <ILogger>(),
                new Type[] { typeof(Resolved1), typeof(Resolved2) });

            Assert.IsTrue(resolver.ContainsType <Resolved1>());
            Assert.IsTrue(resolver.ContainsType <Resolved2>());
            Assert.IsFalse(resolver.ContainsType <Resolved3>());
            //Assert.IsFalse(resolver.ContainsType<Resolved4>()); // does not compile
        }