[InlineData("? *", 0)] //incorrect data as special characters public void Scan_Calculate_Product_Price(string inputproducts, double expectedvalue) { //given var sut = new TerminalService(scanService, priceService, totalcalculationService); sut.SetPrice(); sut.Scan(inputproducts); //when var actualprice = sut.CalculateTotal(); //then Assert.IsType <double>(actualprice); Assert.Equal(expectedvalue, actualprice); }
public void Scan_Products(string scanProducts, double expected) { //given moqTotalCalculateService.Setup(m => m.CalculateTotal(It.IsAny <ProductListandScanCount>())).Returns(expected); var sut = new TerminalService(moqScanService.Object, moqPriceService.Object, moqTotalCalculateService.Object); //when sut.SetPrice(); sut.Scan(scanProducts); var actual = sut.CalculateTotal(); //then Assert.IsType <double>(actual); Assert.Equal(expected, actual); moqPriceService.Verify(v => v.SetPrice(), Times.Once); moqScanService.Verify(v => v.Scan(It.IsAny <ItemstoScan>()), Times.Once); moqTotalCalculateService.Verify(v => v.CalculateTotal(It.IsAny <ProductListandScanCount>()), Times.Once); }