Пример #1
0
        public void BindingCalledForExplicitTypeAlreadyAdded()
        {
            AGSEmptyEntity       entity = new AGSEmptyEntity("test", Mocks.GetResolver());
            AGSCropSelfComponent crop   = new AGSCropSelfComponent();

            entity.AddComponent <ICropSelfComponent>(crop);
            bool bindingCalled = false;

            entity.Bind <ICropSelfComponent>(c =>
            {
                Assert.AreSame(crop, c);
                bindingCalled = true;
            }, _ => Assert.Fail("Component was somehow removed"));
            Assert.IsTrue(bindingCalled);
        }
Пример #2
0
        public void BindingCalledForExplicitType()
        {
            AGSEmptyEntity       entity = new AGSEmptyEntity("test", Mocks.GetResolver());
            AGSCropSelfComponent crop   = new AGSCropSelfComponent();
            bool bindingCalled          = false;

            entity.Bind <ICropSelfComponent>(c =>
            {
                Assert.AreSame(crop, c);
                bindingCalled = true;
            }, _ => {});
            Assert.IsFalse(bindingCalled);
            entity.AddComponent <ICropSelfComponent>(crop);
            Assert.IsTrue(bindingCalled);
        }