Ejemplo n.º 1
0
        public void Test2InterfacesContainerBindingPersistence()
        {
            IDIContext      context     = ContextHelper.CreateContext();
            SingletonBinder modelBinder = new SingletonBinder(context);

            modelBinder.BindMany <IAdvancedRead, IAdvancedWrite>(() => new AdvancedModel());

            SingletoneCreation(context);
            IAdvancedRead read = context.Resolve <IAdvancedRead>();

            Assert.That(read is AdvancedModel);
            Assert.AreEqual("my_test_model", read.tag);
        }
Ejemplo n.º 2
0
        public void Test2InterfacesContainerBinding()
        {
            IDIContext context = ContextHelper.CreateContext();

            // Then creating bindings for 2 interfaces through the container
            context.s().BindMany <IAdvancedRead, IAdvancedWrite>(() => new AdvancedModel());

            IAdvancedRead  read  = context.Resolve <IAdvancedRead>();
            IAdvancedWrite write = context.Resolve <IAdvancedWrite>();

            Assert.That(read is AdvancedModel);
            Assert.That(write is AdvancedModel);

            Assert.AreSame(read, write);
        }