private void SetUpPricing() { _terminal.SetPricing(SellerClient.CreateProduct("A", 1.25m, 3, 3m)); _terminal.SetPricing(SellerClient.CreateProduct("B", 4.25m)); _terminal.SetPricing(SellerClient.CreateProduct("C", 1m, 6, 5m)); _terminal.SetPricing(SellerClient.CreateProduct("D", 0.75m)); }
public void CanCreateVolumeProduct() { // Assert Product product; // Act product = SellerClient.CreateProduct("A", 1.25m, 3, 3m); var result = product as VolumeProduct; // Arrange Assert.NotNull(result); Assert.Equal(3m, result.VolumePrice); }
public void CanScanProduct() { // Assert _terminal = new PointOfSaleTerminal(); var product = SellerClient.CreateProduct("A", 1.25m, 3, 3m); // Act _terminal.SetPricing(product); var returnedProduct = _terminal.Scan("A"); // Arrange Assert.NotNull(returnedProduct); Assert.Equal(1.25m, returnedProduct.Price); }
public void CanCreateUnitProduct() { // Assert Product product; // Act product = SellerClient.CreateProduct("A", 1.25m); var result = product is VolumeProduct; // Arrange Assert.False(result); Assert.NotNull(product); Assert.Equal(1.25m, product.Price); }
public void CanCalculateTotal() { // Assert const int count = 10; var product = SellerClient.CreateProduct("A", 1.25m, 3, 3m); // Act for (var i = 0; i < count; i++) { product.Buy(); } // Arrange Assert.NotNull(product); Assert.Equal(10.25m, product.Cost); }
public void CanBuyProduct() { // Assert const int count = 10; var product = SellerClient.CreateProduct("A", 1.25m); // Act for (var i = 0; i < count; i++) { product.Buy(); } // Arrange Assert.NotNull(product); Assert.Equal(count, product.Count); }