Beispiel #1
0
        public static Cost Parse(IResolvable source, string manaCost)
        {
            var manaAmounts = ManaParser.Parse(manaCost);

            if (manaAmounts == null)
            {
                return(new NoCost(source));
            }
            return(new ManaCost(source, manaAmounts));
        }
        private void testManaParser(string testString, ManaAmount[] expectedResult)
        {
            var actualResult = ManaParser.Parse(testString);

            if (expectedResult == null)
            {
                Assert.IsNull(actualResult);
            }
            else
            {
                Assert.IsNotNull(actualResult);
                Assert.AreEqual(expectedResult.Length, actualResult.Length);
                for (int i = 0; i < actualResult.Length; i++)
                {
                    Assert.AreEqual(expectedResult[i].Amount, actualResult[i].Amount);
                    Assert.AreEqual(expectedResult[i].Color, actualResult[i].Color);
                }
            }
        }