Example #1
0
        public void DefaultComponentTest()
        {
            SnowLake lake = new SnowLake();

            lake.RegisterComponent("t", () => 10);
            lake.RegisterComponent("t", () => 1);
            lake.RegisterComponent("t", () => 2);
            Assert.IsTrue((lake.GetComponent("t") as int?) == 10);
        }
Example #2
0
        public void ExtensionMethodTest()
        {
            IRegisterableLake lake = new SnowLake();

            lake.RegisterComponent("t", () => - 1);
            lake.RegisterComponent("t", () => 1);
            lake.RegisterComponent("t", () => 2);

            Assert.IsTrue(lake.GetComponents("t").Count() == 3);
            Assert.IsTrue((lake.GetComponent("t") as int?) == -1);
        }