public void Scan_UnexistingProductCodeShouldRaiseException() { string productCode = "E"; Action act = () => terminal.Scan(productCode); PointOfScaleException exception = Assert.Throws <PointOfScaleException>(act); Assert.Equal($"Unexisting product code: {productCode}", exception.Message); }
public void Scan_UnexistingProductCodeShouldRaiseException() { string productCode = "E"; mockProductRangeService.Setup(m => m.GetByCode(productCode)).Returns <Product>(null).Verifiable(); Action act = () => terminal.Scan(productCode); PointOfScaleException exception = Assert.Throws <PointOfScaleException>(act); Assert.Equal($"Unexisting product code: {productCode}", exception.Message); mockProductRangeService.Verify(); }
public void SetPricing_NotUniqueProducCodesShouldRaiseException() { ProductDTO dublicateProduct = new ProductDTO { Code = "A" }; products.Add(dublicateProduct); Action act = () => terminal.SetPricing(products); PointOfScaleException exception = Assert.Throws <PointOfScaleException>(act); Assert.Equal("Product codes are not unique", exception.Message); }