示例#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);
        }
示例#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();
        }
示例#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);
        }