示例#1
0
        public Entity AddDictionary(System.Collections.Generic.Dictionary <string, string> newDict)
        {
            var component = new DictionaryComponent();

            component.dict = newDict;
            return(AddDictionary(component));
        }
        public void Test_GetComponentGeneric_Non_existing_component()
        {
            DictionaryComponent dictionary = new DictionaryComponent();

            var thisComponent = dictionary.GetComponent <StubComponent>();

            Assert.IsNull(thisComponent);
        }
        public void Test_RemoveComponent()
        {
            DictionaryComponent dictionary = new DictionaryComponent();
            IComponent          component  = new StubComponent();

            dictionary.Remove(component);

            var thisComponent = dictionary.GetComponent <StubComponent>();

            Assert.AreNotSame(thisComponent, component);
        }
        public void Test_GetComponentByString()
        {
            DictionaryComponent dictionary = new DictionaryComponent();
            IComponent          component  = new StubComponent();

            dictionary.Add(component);

            var thisComponent = dictionary.GetComponent("StubComponent");

            Assert.AreSame(component, thisComponent);
        }
        public void Test_GetComponentGeneric()
        {
            DictionaryComponent dictionary = new DictionaryComponent();
            IComponent          component  = new StubComponent();

            dictionary.Add(component);

            var thisComponent = dictionary.GetComponent <StubComponent>();

            Assert.AreSame(component, thisComponent);
        }
 public Entity ReplaceDictionary(System.Collections.Generic.Dictionary<string, string> newDict)
 {
     DictionaryComponent component;
     if (hasDictionary) {
         WillRemoveComponent(ComponentIds.Dictionary);
         component = dictionary;
     } else {
         component = new DictionaryComponent();
     }
     component.dict = newDict;
     return ReplaceComponent(ComponentIds.Dictionary, component);
 }
        public void Test_GetComponent()
        {
            DictionaryComponent dictionary = new DictionaryComponent();
            IComponent          component  = new StubComponent();

            dictionary.Add(component);

            // не обрабатывавает имключение, если такого компонента нет в словаре
            var thisComponent = dictionary.GetComponent(typeof(StubComponent));

            Assert.AreSame(component, thisComponent);
        }
示例#8
0
        public Entity ReplaceDictionary(System.Collections.Generic.Dictionary <string, string> newDict)
        {
            DictionaryComponent component;

            if (hasDictionary)
            {
                WillRemoveComponent(ComponentIds.Dictionary);
                component = dictionary;
            }
            else
            {
                component = new DictionaryComponent();
            }
            component.dict = newDict;
            return(ReplaceComponent(ComponentIds.Dictionary, component));
        }
        public void Test_GetComponentsGeneric()
        {
            DictionaryComponent dictionary = new DictionaryComponent();
            IComponent          component1 = new StubComponent();
            IComponent          component2 = new MockComponent();

            dictionary.Add(component1);
            dictionary.Add(component2);

            var receivedComponents = dictionary.GetComponents <IComponent>();

            IComponent ReceivedComponent1 = receivedComponents[0];
            IComponent ReceivedComponent2 = receivedComponents[1];

            Assert.AreEqual(2, receivedComponents.Length);
            Assert.AreSame(component1, ReceivedComponent1);
            Assert.AreSame(component2, ReceivedComponent2);
        }
 public Entity AddDictionary(System.Collections.Generic.Dictionary<string, string> newDict)
 {
     var component = new DictionaryComponent();
     component.dict = newDict;
     return AddDictionary(component);
 }
 public Entity AddDictionary(DictionaryComponent component)
 {
     return AddComponent(ComponentIds.Dictionary, component);
 }
示例#12
0
 public void Test_GetComponentByString_Non_existing_component()
 {
     DictionaryComponent dictionary = new DictionaryComponent();
     var thisComponent = dictionary.GetComponent("StubComponent");
 }
示例#13
0
 public Entity AddDictionary(DictionaryComponent component)
 {
     return(AddComponent(ComponentIds.Dictionary, component));
 }