Ejemplo n.º 1
0
        public void TestMethod1()
        {
            TestCase1[] testSet = new TestCase1[]
            {
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 1, 100 }
                    }, null), result = false
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 100 }
                    }, null), result = false
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 1, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 100 }
                    }, null), result = true
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 100 }
                    }, null), result = true
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 1, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 100 }
                    }, null), result = false
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 1, 100 }
                    }, null), result = true
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 150 }
                    }, null), result = false
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 200 }
                    }, null), result = false
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 150 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 100 }
                    }, null), result = true
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 200 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 0, 100 }
                    }, null), result = true
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 150 }
                    }, null), result = false
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 100 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 200 }
                    }, null), result = false
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 150 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 100 }
                    }, null), result = true
                },
                new TestCase1 {
                    army1 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 200 }
                    }, null),
                    army2 = new Fleet(0, new Dictionary <int, int> {
                        { 2, 100 }
                    }, null), result = true
                }
            };

            foreach (TestCase1 testCase in testSet)
            {
                Assert.IsTrue(BattleLogic.ArrangeBattle(testCase.army1, testCase.army2) == testCase.result);
                Assert.IsTrue(testCase.result ? testCase.army2.IsEmpty : testCase.army1.IsEmpty);
            }
        }