Exemplo n.º 1
0
        public void RegistrationWithParamsTestMethod()
        {
            var container = new Container();

            container.Register(typeof(Toyota));
            object[] parameters = { "Corolla", 2008 };
            var      expected   = new Toyota();

            Assert.AreEqual(expected.GetType(), container.Resolve(typeof(Toyota), parameters).GetType());
        }
Exemplo n.º 2
0
        public void RegistrationWithLabelsTestMethod()
        {
            var container = new Container();

            container.Register(typeof(ICar), typeof(BMW), "BMW X5");
            container.Register(typeof(ICar), typeof(Toyota), "Toyota Celica");
            var bmwExpected    = new BMW();
            var toyotaExpected = new Toyota();
            var bmwActual      = container.Resolve(typeof(ICar), "BMW X5");
            var toyotaActual   = container.Resolve(typeof(ICar), "Toyota Celica");

            Assert.AreEqual(2, container.Count);
            Assert.AreEqual(bmwExpected.GetType(), bmwActual.GetType());
            Assert.AreEqual(toyotaExpected.GetType(), toyotaActual.GetType());
        }