Exemplo n.º 1
0
        public void TestPositionComponent()
        {
            var testComponent1 = new PositionComponent(0, 5, 10, 100);

            Assert.AreEqual(5, testComponent1.XLoc);
            Assert.AreEqual(10, testComponent1.YLoc);
            Assert.AreEqual(100, testComponent1.LevelId);
            Assert.AreEqual(ComponentType.Position, testComponent1.componentType);

            var paramDict = new Dictionary <string, string> {
                { "EntityName", "TestEntity" },
                { "XLoc", "5" },
                { "YLoc", "10" },
                { "LevelId", "100" }
            };

            var testComponent2 = new PositionComponent(0, paramDict);

            Assert.AreEqual(5, testComponent2.XLoc);
            Assert.AreEqual(10, testComponent2.YLoc);
            Assert.AreEqual(100, testComponent2.LevelId);
            Assert.AreEqual(ComponentType.Position, testComponent2.componentType);

            testComponent2.UpdatePosition(7, 8);

            Assert.AreEqual(7, testComponent2.XLoc);
            Assert.AreEqual(8, testComponent2.YLoc);
        }