Ejemplo n.º 1
0
        public void ManyResolverCannotInsertBeforeTypeOnceFrozen()
        {
            var resolver = new ManyResolver(new Type[] { typeof(Resolved1), typeof(Resolved2) });

            Resolution.Freeze();
            resolver.InsertTypeBefore <Resolved2, Resolved3>();
        }
Ejemplo n.º 2
0
        public void ManyResolverCannotInsertBeforeInvalidType()
        {
            var resolver = new ManyResolver(new Type[] { typeof(Resolved1), typeof(Resolved2) });

            //resolver.InsertTypeBefore<Resolved2, Resolved4>(); // does not compile
            resolver.InsertTypeBefore(typeof(Resolved2), typeof(Resolved4)); // throws
        }
Ejemplo n.º 3
0
        public void ManyResolverCannotInsertBeforeInvalidType()
        {
            var resolver = new ManyResolver(new ActivatorServiceProvider(), Mock.Of <ILogger>(), new Type[] { typeof(Resolved1), typeof(Resolved2) });

            //resolver.InsertTypeBefore<Resolved2, Resolved4>(); // does not compile
            resolver.InsertTypeBefore(typeof(Resolved2), typeof(Resolved4)); // throws
        }
Ejemplo n.º 4
0
        public void ManyResolverCannotInsertBeforeTypeOnceFrozen()
        {
            var resolver = new ManyResolver(new ActivatorServiceProvider(), Mock.Of <ILogger>(), new Type[] { typeof(Resolved1), typeof(Resolved2) });

            Resolution.Freeze();
            resolver.InsertTypeBefore <Resolved2, Resolved3>();
        }
Ejemplo n.º 5
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>());
        }
Ejemplo n.º 6
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>());
        }
Ejemplo n.º 7
0
        public void ManyResolverDefaultOrderOfTypes()
        {
            var resolver = new ManyResolver();

            resolver.AddType <Resolved3>();
            resolver.InsertType <Resolved1>(0);
            resolver.InsertTypeBefore <Resolved3, Resolved2>();
            Resolution.Freeze();
            var values = resolver.ResolvedObjects;

            Assert.AreEqual(3, values.Count());
            Assert.IsInstanceOf <Resolved1>(values.ElementAt(0));
            Assert.IsInstanceOf <Resolved2>(values.ElementAt(1));
            Assert.IsInstanceOf <Resolved3>(values.ElementAt(2));
        }
Ejemplo n.º 8
0
        public void ManyResolverCannotInsertBeforeAbsentType()
        {
            var resolver = new ManyResolver(new Type[] { typeof(Resolved1) });

            resolver.InsertTypeBefore <Resolved2, Resolved3>();
        }
Ejemplo n.º 9
0
        public void ManyResolverCannotInsertBeforeTypeAgain()
        {
            var resolver = new ManyResolver(new Type[] { typeof(Resolved1), typeof(Resolved2) });

            resolver.InsertTypeBefore <Resolved2, Resolved1>();
        }
Ejemplo n.º 10
0
        public void ManyResolverCannotInsertBeforeAbsentType()
        {
            var resolver = new ManyResolver(new ActivatorServiceProvider(), Mock.Of <ILogger>(), new Type[] { typeof(Resolved1) });

            resolver.InsertTypeBefore <Resolved2, Resolved3>();
        }