Beispiel #1
0
        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);
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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);
        }