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.

117 lines
3.7 KiB

  1. using System;
  2. using Xunit;
  3. namespace JobNimbus_application
  4. {
  5. public class UnitTest1
  6. {
  7. [Fact]
  8. public void Test1()
  9. {
  10. string testString = "{}";
  11. Console.WriteLine($"Testing \"{testString}\", should be true");
  12. Assert.True(BracketService.isFullyBracketed(testString));
  13. }
  14. [Fact]
  15. public void Test2()
  16. {
  17. string testString = "}{";
  18. Console.WriteLine($"Testing \"{testString}\", should be false");
  19. Assert.False(BracketService.isFullyBracketed(testString));
  20. }
  21. [Fact]
  22. public void Test3()
  23. {
  24. string testString = "{{}";
  25. Console.WriteLine($"Testing \"{testString}\", should be false");
  26. Assert.False(BracketService.isFullyBracketed(testString));
  27. }
  28. [Fact]
  29. public void Test4()
  30. {
  31. string testString = "";
  32. Console.WriteLine($"Testing \"{testString}\", should be true");
  33. Assert.True(BracketService.isFullyBracketed(testString));
  34. }
  35. [Fact]
  36. public void Test5()
  37. {
  38. string testString = "{{{{}";
  39. Console.WriteLine($"Testing \"{testString}\", should be false");
  40. Assert.False(BracketService.isFullyBracketed(testString));
  41. }
  42. [Fact]
  43. public void Test6()
  44. {
  45. string testString = "{}{";
  46. Console.WriteLine($"Testing \"{testString}\", should be false");
  47. Assert.False(BracketService.isFullyBracketed(testString));
  48. }
  49. [Fact]
  50. public void Test7()
  51. {
  52. string testString = "{}{}{}";
  53. Console.WriteLine($"Testing \"{testString}\", should be true");
  54. Assert.True(BracketService.isFullyBracketed(testString));
  55. }
  56. [Fact]
  57. public void Test8()
  58. {
  59. string testString = "{}{}{}}";
  60. Console.WriteLine($"Testing \"{testString}\", should be false");
  61. Assert.False(BracketService.isFullyBracketed(testString));
  62. }
  63. [Fact]
  64. public void Test9()
  65. {
  66. string testString = "{cat}{dog}{cow}";
  67. Console.WriteLine($"Testing \"{testString}\", should be true");
  68. Assert.True(BracketService.isFullyBracketed(testString));
  69. }
  70. [Fact]
  71. public void Test10()
  72. {
  73. int[] multiples = {3,5};
  74. int range = 10;
  75. Console.WriteLine($"Getting sum of multiples of {string.Join(',', multiples)} from 0-{range}. Should be 23");
  76. Assert.Equal(23, SumService.sumMultiples(multiples, range));
  77. }
  78. [Fact]
  79. public void Test11()
  80. {
  81. int[] multiples = {3,5};
  82. int range = 20;
  83. Console.WriteLine($"Getting sum of multiples of {string.Join(',', multiples)} from 0-{range}. Should be 78");
  84. Assert.Equal(78, SumService.sumMultiples(multiples, range));
  85. }
  86. [Fact]
  87. public void Test12()
  88. {
  89. int[] multiples = {3,5};
  90. int range = 1000;
  91. Console.WriteLine($"Getting sum of multiples of {string.Join(',', multiples)} from 0-{range}. Should be 233168");
  92. Assert.Equal(233168, SumService.sumMultiples(multiples, range));
  93. }
  94. [Fact]
  95. public void Test13()
  96. {
  97. int[] multiples = {1,3,5};
  98. int range = 10;
  99. Console.WriteLine($"Getting sum of multiples of {string.Join(',', multiples)} from 0-{range}. Should be 45");
  100. Assert.Equal(45, SumService.sumMultiples(multiples, range));
  101. }
  102. }
  103. }