Example #1
0
        public void FindNonExistentDeckReturnsNull()
        {
            var decks  = new Dictionary <long, Deck>();
            var parent = new Deck()
            {
                Name = "parent"
            };
            var child = new Deck()
            {
                Name = "parent::child"
            };
            var grandchild = new Deck()
            {
                Name = "parent::child::grandchild"
            };

            decks.Add(1, parent);
            decks.Add(2, child);
            decks.Add(3, grandchild);

            var tree = new DeckTreeDictionary(decks);

            var p = tree.Find("james");

            Assert.Null(p);

            var c = tree.Find("ben");

            Assert.Null(c);

            var g = tree.Find("luke");

            Assert.Null(g);
        }
Example #2
0
        public void FindDeckReturnsDeck()
        {
            var decks  = new Dictionary <long, Deck>();
            var parent = new Deck()
            {
                Name = "parent"
            };
            var child = new Deck()
            {
                Name = "parent::child"
            };
            var grandchild = new Deck()
            {
                Name = "parent::child::grandchild"
            };

            decks.Add(1, parent);
            decks.Add(2, child);
            decks.Add(3, grandchild);

            var tree = new DeckTreeDictionary(decks);

            var p = tree.Find("parent");

            Assert.Equal(parent, p);

            var c = tree.Find("parent::child");

            Assert.Equal(child, c);

            var g = tree.Find("parent::child::grandchild");

            Assert.Equal(grandchild, g);
        }