public void Invoke_ProductServiceFindProductByName() { //Arrange var mockProductService = new Mock <IProductService>(); var stubReader = new Mock <IReader>(); var stubWriter = new Mock <IWriter>(); var testedCommand = new SearchProductCommand (stubReader.Object, stubWriter.Object, mockProductService.Object); //Act testedCommand.ExecuteThisCommand(); //Assert mockProductService.Verify(x => x.FindProductByName(It.IsAny <string>()), Times.Once); }
public void Invoke_ReaderRead() { //Arrange var stubProductService = new Mock <IProductService>(); var mockReader = new Mock <IReader>(); var stubWriter = new Mock <IWriter>(); var testedCommand = new SearchProductCommand (mockReader.Object, stubWriter.Object, stubProductService.Object); //Act testedCommand.ExecuteThisCommand(); //Assert mockReader.Verify(x => x.Read(), Times.Once); }
public void GetProductsSellingPrice_IfMatchExist() { //Arrange var stubProductService = new Mock <IProductService>(); var stubReader = new Mock <IReader>(); var stubWriter = new Mock <IWriter>(); var mockProduct = new Mock <IProductModel>(); stubProductService.Setup(x => x.FindProductByName(It.IsAny <string>())) .Returns(mockProduct.Object); var testedCommand = new SearchProductCommand (stubReader.Object, stubWriter.Object, stubProductService.Object); //Act testedCommand.ExecuteThisCommand(); //Assert mockProduct.Verify(x => x.SellingPrice, Times.Once); }