public void TestLookupCountAfterDelete()
        {
            IBlackboard blackboard = new Blackboard();

            TestUnit1 u1 = new TestUnit1("one");
            TestUnit1 u2 = new TestUnit1("two");
            TestUnit1 u3 = new TestUnit1("three");

            TestUnit2 u4 = new TestUnit2(1);
            TestUnit2 u5 = new TestUnit2(2);

            string type1 = u1.GetType().FullName;
            string type2 = u4.GetType().FullName;

            blackboard.AddUnit(u1);
            blackboard.AddUnit(u2);
            blackboard.AddUnit(u3);
            blackboard.AddUnit(u4);
            blackboard.AddUnit(u5);

            ISet <IUnit> set1 = blackboard.LookupUnits(type1);
            ISet <IUnit> set2 = blackboard.LookupUnits(type2);

            Assert.Equal(3, set1.Count);
            Assert.Equal(2, set2.Count);

            blackboard.DeleteUnit(u1);
            blackboard.DeleteUnit(u4);

            set1 = blackboard.LookupUnits(type1);
            set2 = blackboard.LookupUnits(type2);

            Assert.Equal(2, set1.Count);
            Assert.Equal(1, set2.Count);
        }
        public void TestAddDeleteContains()
        {
            IBlackboard blackboard = new Blackboard();
            TestUnit1   u1         = new TestUnit1("one");
            TestUnit1   u2         = new TestUnit1("two");
            TestUnit1   u3         = new TestUnit1("three");

            blackboard.AddUnit(u1);
            blackboard.AddUnit(u2);
            blackboard.AddUnit(u3);
            Assert.True(blackboard.ContainsUnit(u1));
            Assert.True(blackboard.ContainsUnit(u2));
            Assert.True(blackboard.ContainsUnit(u3));
            blackboard.DeleteUnit(u3);
            Assert.False(blackboard.ContainsUnit(u3));
            Assert.True(blackboard.ContainsUnit(u2));
            Assert.True(blackboard.ContainsUnit(u1));
            blackboard.DeleteUnit(u2);
            Assert.False(blackboard.ContainsUnit(u3));
            Assert.False(blackboard.ContainsUnit(u2));
            Assert.True(blackboard.ContainsUnit(u1));
            blackboard.DeleteUnit(u1);
            Assert.False(blackboard.ContainsUnit(u3));
            Assert.False(blackboard.ContainsUnit(u2));
            Assert.False(blackboard.ContainsUnit(u1));
        }
        public void TestLookupAfterDeleteIsNull()
        {
            IBlackboard blackboard = new Blackboard();

            TestUnit1 u1    = new TestUnit1("one");
            TestUnit2 u2    = new TestUnit2(1);
            string    type1 = u1.GetType().FullName;
            string    type2 = u2.GetType().FullName;

            blackboard.AddUnit(u1);
            blackboard.AddUnit(u2);

            Assert.NotNull(blackboard.LookupUnits(type1));
            Assert.NotNull(blackboard.LookupUnits(type2));

            blackboard.DeleteUnit(u1);
            Assert.Null(blackboard.LookupUnits(type1));

            blackboard.DeleteUnit(u2);
            Assert.Null(blackboard.LookupUnits(type2));
        }