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]); }
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); }
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]); }