A stealth-based 2D platformer where you don't have to kill anyone unless you want to. https://www.semicolin.games
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. namespace SemiColinGames.Tests {
  4. [TestClass]
  5. public class HistoryTests {
  6. [TestMethod]
  7. public void TestLength() {
  8. var h = new History<int>(3);
  9. Assert.AreEqual(3, h.Length);
  10. }
  11. [TestMethod]
  12. public void TestGetFromEmpty() {
  13. var ints = new History<int>(3);
  14. Assert.AreEqual(0, ints[0]);
  15. Assert.AreEqual(0, ints[1]);
  16. Assert.AreEqual(0, ints[2]);
  17. var objects = new History<Object>(1);
  18. Assert.AreEqual(null, objects[0]);
  19. }
  20. [TestMethod]
  21. public void TestAdds() {
  22. var h = new History<int>(3);
  23. Assert.AreEqual("0 0 0", String.Format("{0} {1} {2}", h[0], h[1], h[2]));
  24. h.Add(2);
  25. Assert.AreEqual("2 0 0", String.Format("{0} {1} {2}", h[0], h[1], h[2]));
  26. h.Add(3);
  27. h.Add(5);
  28. Assert.AreEqual("5 3 2", String.Format("{0} {1} {2}", h[0], h[1], h[2]));
  29. h.Add(7);
  30. Assert.AreEqual("7 5 3", String.Format("{0} {1} {2}", h[0], h[1], h[2]));
  31. h.Add(11);
  32. h.Add(13);
  33. Assert.AreEqual("13 11 7", String.Format("{0} {1} {2}", h[0], h[1], h[2]));
  34. }
  35. [TestMethod]
  36. public void TestThrowsExceptions() {
  37. var h = new History<int>(3);
  38. Assert.ThrowsException<IndexOutOfRangeException>(() => h[-1]);
  39. Assert.ThrowsException<IndexOutOfRangeException>(() => h[3]);
  40. }
  41. }
  42. }