public void PotterTotalNoDiscounts() { //Arrange int[] bookArray = { 0 }; KataPotter potter = new KataPotter(); decimal expectedTotal = (8M * 1); //Act decimal actualCost = potter.GetCost(bookArray); //Assert Assert.AreEqual(expectedTotal, actualCost); //Arrange bookArray = new int[] { 0, 0 }; expectedTotal = (8M * 2); //Act actualCost = potter.GetCost(bookArray); //Assert Assert.AreEqual(expectedTotal, actualCost); //Arrange bookArray = new int[] { 4, 4, 4, 4, 4 }; expectedTotal = (8M * 5); //Act actualCost = potter.GetCost(bookArray); //Assert Assert.AreEqual(expectedTotal, actualCost); }
public void PotterTest() { KataPotter thisKata = new KataPotter(); int[] books1 = { 3, 2, 1, 5, 1, 3 }; Assert.AreEqual(40.8M, thisKata.GetCost(books1)); //int[] books2 = { 1, 2, 4, 3, 5, 3, 2 }; //Assert.AreEqual(42, thisKata.GetCost(books2)); int[] books3 = { 2 }; Assert.AreEqual(8, thisKata.GetCost(books3)); int[] books4 = { 1, 2, 4, 5 }; Assert.AreEqual(25.6M, thisKata.GetCost(books4)); int[] books5 = { 2, 4 }; Assert.AreEqual(15.2M, thisKata.GetCost(books5)); }
public void PotterDiscountsForOneGroup() { //Arrange int[] bookArray = { 0, 1 }; KataPotter potter = new KataPotter(); decimal expectedTotal = (8M * 2 * 0.95M); //Act decimal actualCost = potter.GetCost(bookArray); //Assert Assert.AreEqual(expectedTotal, actualCost); //Arrange bookArray = new int[] { 0, 1, 2 }; expectedTotal = (8M * 3 * 0.90M); //Act actualCost = potter.GetCost(bookArray); //Assert Assert.AreEqual(expectedTotal, actualCost); //Arrange bookArray = new int[] { 0, 1, 2, 3 }; expectedTotal = (8M * 4 * 0.80M); //Act actualCost = potter.GetCost(bookArray); //Assert Assert.AreEqual(expectedTotal, actualCost); //Arrange bookArray = new int[] { 0, 1, 2, 3, 4 }; expectedTotal = (8M * 5 * 0.75M); //Act actualCost = potter.GetCost(bookArray); //Assert Assert.AreEqual(expectedTotal, actualCost); }
public void TestPotter(double expectedResult, int[] books) { // Arrange // Create a new Potter object KataPotter subject = new KataPotter(); // Act double actualResult = subject.GetCost(books); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void PotterNoPurchase() { //Arrange int[] emptyArray = { }; KataPotter potter = new KataPotter(); decimal expectedTotal = (8M * 0); //Act decimal actualCost = potter.GetCost(emptyArray); //Assert Assert.AreEqual(expectedTotal, actualCost); }
public void PotterSameBookDiscounts() { //Arrange KataPotter potterArrays = new KataPotter(); int[] oneBookArray = { 0, 0, 1, 1 }; decimal expectedTotal = (2 * (8M * 2 * 0.95M)); //Act decimal actualCost = potterArrays.GetCost(oneBookArray); //Assert Assert.AreEqual(expectedTotal, actualCost); }
public void Potter_TestPrice() { testPotter = new KataPotter(new int[] { 2, 2, 2, 1, 1 }); Assert.AreEqual(51.20M, testPotter.GetCost(), "Price should be $51.20"); testPotter = new KataPotter(new int[] { 4, 4, 1, 5, 2 }); Assert.AreEqual(101.6M, testPotter.GetCost(), "Price should be $101.6"); testPotter = new KataPotter(new int[] { 4, 2, 0, 6, 1 }); Assert.AreEqual(75.2M, testPotter.GetCost(), "Price should be $75.2"); testPotter = new KataPotter(new int[] { 5, 5, 5, 0, 0 }); Assert.AreEqual(84M, testPotter.GetCost(), "Price should be $84.00"); testPotter = new KataPotter(new int[] { 3, 3, 7, 7, 7 }); Assert.AreEqual(170.4M, testPotter.GetCost(), "Price should be $170.4"); testPotter = new KataPotter(new int[] { 4, 4, 4, 3, 3 }); Assert.AreEqual(119.2M, testPotter.GetCost(), "Price should be $119.20"); }
public void BuyOneBook() { Assert.AreEqual(8m, kata.GetCost(new int[] { 1 }), "Purchase a single book"); }
public void GetCostOf0BooksEntered() { //Arrange List <int> input = new List <int>() { 0, 0, 0, 0, 0 }; decimal output = 0.0m; //act Assert Assert.AreEqual(output, testObject.GetCost(input)); }
public void GetCost_CheckForSetOf5() { int[] bookArray = { 1, 1, 1, 1, 1 }; Assert.AreEqual(SetOf5, kataPotter.GetCost(bookArray)); }
public void SingleBookPurchaseTests() { inputArray[0] = 1; Assert.AreEqual(8M, kataPotter.GetCost(inputArray), "Test 1.1"); inputArray[0] = 0; inputArray[1] = 1; Assert.AreEqual(8M, kataPotter.GetCost(inputArray), "Test 1.2"); inputArray[1] = 0; inputArray[2] = 1; Assert.AreEqual(8M, kataPotter.GetCost(inputArray), "Test 1.3"); inputArray[2] = 0; inputArray[3] = 1; Assert.AreEqual(8M, kataPotter.GetCost(inputArray), "Test 1.4"); inputArray[3] = 0; inputArray[4] = 1; Assert.AreEqual(8M, kataPotter.GetCost(inputArray), "Test 1.5"); }