Exemplo n.º 1
0
            public void TestDeepCopy()
            {
                Player testplayer = new Player(1, 0, 0, "TestPlayer", 20, 5, 5, 1, 0, 0);

                for (int i = 0; i < 10; i++)
                {
                    testplayer.addKill();
                }
                Player playercopy = (Player)testplayer.DeepClone();

                Assert.AreNotEqual(testplayer.kc, playercopy.kc);
                Assert.AreEqual(testplayer.kc.killCount, playercopy.kc.killCount);
                var items_p1 = testplayer.getItems();
                var items_p2 = playercopy.getItems();

                Assert.AreNotEqual(items_p1, items_p2);
                Assert.AreEqual(items_p2.Count, items_p2.Count); // TODO compare actual items
            }
Exemplo n.º 2
0
            public void TestShallowCopy()
            {
                Player testplayer = new Player(1, 0, 0, "TestPlayer", 20, 5, 5, 1, 0, 0);

                for (int i = 0; i < 10; i++)
                {
                    testplayer.addKill();
                }
                Player playercopy = (Player)testplayer.Clone();

                Assert.AreNotEqual(testplayer.kc, playercopy.kc);
                Assert.AreNotEqual(testplayer.kc.killCount, playercopy.kc.killCount);
                var items_p1 = testplayer.getItems();
                var items_p2 = playercopy.getItems();

                Assert.AreNotEqual(items_p1, items_p2);
                Assert.IsTrue(items_p2.Count == 0);
            }