예제 #1
0
        protected static TokenCollection Create(string[] pTokens)
        {
            TokenCollection a = new TokenCollection();
            foreach (string token in pTokens)
            {
                a.Add(token);
            }

            Assert.AreEqual(pTokens.Length, a.Sum);
            Assert.AreEqual(pTokens.Distinct().Count(), a.Count);
            foreach (string token in pTokens)
            {
                Assert.AreNotEqual(0, a.get(token));
            }

            return a;
        }
        public void Test_Subtract_Rule()
        {
            TokenCollection a = new TokenCollection();
            a.Add("mouse");
            a.Add("mouse");
            a.Add("mouse");

            TokenCollection b = new TokenCollection();
            b.Add("house");
            b.Add("house");

            try
            {
                TokenCollection.Subtract(b, a);
                Assert.Fail();
            }
            catch (ArgumentException)
            {
            }
        }