AddKey() публичный Метод

public AddKey ( int key ) : void
key int
Результат void
Пример #1
0
        public void CanOpenThreeChestsWithThreeKeys()
        {
            Trove trove = new Trove();
            trove.AddKey(1);
            trove.AddKey(1);
            trove.AddKey(1);
            trove.AddChest(new Chest(1, new int[] { }));
            trove.AddChest(new Chest(1, new int[] { }));
            trove.AddChest(new Chest(1, new int[] { }));

            var result = trove.GetSolution();

            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.Count);
            Assert.AreEqual(0, result[0]);
            Assert.AreEqual(1, result[1]);
            Assert.AreEqual(2, result[2]);
            Assert.AreEqual(3, result[3]);
        }
Пример #2
0
        public void CannotOpenOneChestWithoutKey()
        {
            Trove trove = new Trove();
            trove.AddKey(2);
            trove.AddChest(new Chest(1, new int[] { 1 }));

            var result = trove.GetSolution();

            Assert.IsNull(result);
        }
Пример #3
0
        public void CanOpenChestWithKey()
        {
            Trove trove = new Trove();
            trove.AddKey(1);
            trove.AddChest(new Chest(1, new int[] { 2, 3 }));

            var result = trove.GetSolution();

            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(0, result[0]);
            Assert.AreEqual(1, result[1]);
        }