Example #1
0
        /// <summary>
        /// 获取所有上下文名称
        /// </summary>
        private static void GetContextName()
        {
            var provider = new ContextDataProvider();

            provider.Configure(Preferences.sharedInstance);
            var data = (ContextData[])provider.GetData();

            ContextNames = data.Select(u => u.GetContextName()).ToArray();
        }
    void when_providing()
    {
        it["creates data for each context name"] = () => {
            var names    = new [] { "Input", "GameState" };
            var provider = new ContextDataProvider(names);

            var data = (ContextData[])provider.GetData();

            data.Length.should_be(names.Length);
            data[0].GetContextName().should_be(names[0]);
            data[1].GetContextName().should_be(names[1]);
        };
    }
        public void CreatesDataForEachContextName()
        {
            var names    = new [] { "Input", "GameState" };
            var provider = new ContextDataProvider();

            provider.Configure(TestTools.CreateSettingsForContextNames(names));

            var data = (ContextData[])provider.GetData();

            Assert.AreEqual(2, data.Length);
            Assert.AreEqual("Input", data[0].GetContextName());
            Assert.AreEqual("GameState", data[1].GetContextName());
        }
    void when_providing()
    {
        it["creates data for each context name"] = () => {
            var names    = "Entitas.CodeGeneration.Plugins.Contexts = Input, GameState";
            var provider = new ContextDataProvider();
            provider.Configure(new Preferences(new Properties(names)));

            var data = (ContextData[])provider.GetData();

            data.Length.should_be(2);
            data[0].GetContextName().should_be("Input");
            data[1].GetContextName().should_be("GameState");
        };
    }