public void RegisterAOT_T_Correct()
        {
            //Arrange
            var container = new InjectionContainer();
            ICommandDispatcher dispatcher;
            someClass          sc = new someClass();

            //Act
            container
            .RegisterAOT <UnityContainerAOT>()
            .RegisterAOT <EventContainerAOT>()
            .RegisterAOT <CommanderContainerAOT>()
            .RegisterCommand <TestCommand1>()
            .Bind <Transform>().ToPrefab("06_Commander/Prism");
            container.PoolCommands();

            dispatcher = container.GetCommandDispatcher();
            dispatcher.Dispatch <TestCommand1>(sc);
            //Assert
            Assert.AreEqual(
                true,
                dispatcher != null &&
                sc.id == 1 &&
                container.GetTypes <Transform>().Count == 1 &&
                ((PrefabInfo)container.GetTypes <Transform>()[0].value).path == "06_Commander/Prism");
        }
Exemplo n.º 2
0
        public void ReBind_FactoryBinding_BinderSaveCorrect()
        {
            //Arrange
            IBinder   binder = new Binder();
            someClass o      = new someClass();

            //Act
            binder.BindFactory <someClass>().To(o).BindSingleton <someClass>().To(new someClass());
            //Assert
            Assert.AreEqual(2, binder.GetAll().Count);
        }
Exemplo n.º 3
0
        public void ToInstance_FactoryBinding_BinderSaveCorrect()
        {
            //Arrange
            IBinder   binder = new Binder();
            someClass o      = new someClass();

            //Act
            binder.BindFactory <someClass>().To(o);
            //Assert
            Assert.AreEqual(
                true,
                binder.GetAll().Count == 1 &&
                binder.GetAll()[0].value == o);
        }