public void ReturnRightJsonResult(int randomPage, int randomPageSize) { // Arange var mockedService = new Mock <IProductService>(); mockedService.Setup(x => x.GetProducts(randomPage, randomPageSize)).Returns(new List <ProductSimpleDto>()); var obj = new ApController(mockedService.Object); // Act obj.WithCallTo(x => x.Products(randomPage, randomPageSize)) .ShouldReturnJson(); }
public void Call_ProductService_WithSameArguments(int randomPage, int randomPageSize) { // Arange var mockedService = new Mock <IProductService>(); mockedService.Setup(x => x.GetProducts(randomPage, randomPageSize)).Verifiable(); var obj = new ApController(mockedService.Object); // Act obj.Products(randomPage, randomPageSize); // Assert mockedService.Verify(); }