Пример #1
0
 public bool Contains(Token token)
 {
     if (tokenCollection.Contains(token))
     {
         return(true);
     }
     return(false);
 }
        public void Test_Add()
        {
            TokenCollection a = Create(new[] { "mouse", "mouse", "mouse" });
            TokenCollection b = Create(new[] { "mouse", "chicken", "chicken" });

            TokenCollection add = TokenCollection.Add(a, b);

            Assert.AreEqual(4, add.Sum);
            Assert.AreEqual(4, add.get("mouse"));
            Assert.IsFalse(add.Contains("chicken"));
            Assert.AreEqual(0, add.get("house"));
        }
        public void Test_Subtract()
        {
            TokenCollection a = Create(new[] { "mouse", "mouse", "mouse" });
            TokenCollection b = Create(new[] { "mouse", "chicken", "chicken" });

            TokenCollection sub = TokenCollection.Subtract(a, b);

            Assert.AreEqual(2, sub.Sum);
            Assert.AreEqual(2, sub.get("mouse"));
            Assert.AreEqual(1, sub.Count);
            Assert.IsFalse(sub.Contains("chicken"));
            Assert.AreEqual(0, sub.get("chicken"));
        }