public void 一二三四集各買了一本_價格應為320() { //arrange var target = new ShoppingCart(); var expected = 320; var firstEpisode = new Book() { Name = "HarryPotterFirstEpisode", Price = 100, Amount = 1 }; var secondEpisod = new Book() { Name = "HarryPotterSecondEpisode", Price = 100, Amount = 1 }; var thirdEpisod = new Book() { Name = "HarryPotterThirdEpisode", Price = 100, Amount = 1 }; var fourthEpisod = new Book() { Name = "HarryPotterFourthEpisode", Price = 100, Amount = 1 }; //act int actual = target.CaculatePrice(new List <Book>() { firstEpisode, secondEpisod, thirdEpisod, fourthEpisod }); //assert Assert.AreEqual(expected, actual); }
public void 第一集買了一本_價格應為100元() { //arrange var target = new ShoppingCart(); var expected = 100; var firstEpisode = new Book() { Name = "HarryPotterFirstEpisode", Price = 100, Amount = 1 }; //act int actual = target.CaculatePrice(new List <Book>() { firstEpisode }); //assert Assert.AreEqual(expected, actual); }