public void GetShouldReturnOrderById() { // Given var expectedProductsInOrder = new [] { Constants.IphoneCase }; A.CallTo(() => _getOrderByIdQuery.Run(Constants.IphoneCaseOrder.Id)) .Returns(expectedProductsInOrder); // When var products = _ordersController.Get(Constants.IphoneCaseOrder.Id); // Then Assert.Equal(expectedProductsInOrder, products); A.CallTo(() => _getOrderByIdQuery.Run(Constants.IphoneCaseOrder.Id)) .MustHaveHappened(); }
public void RunShouldReturnAllProducts() { // Given var expectedProductsInOrder = new[] { Constants.IphoneCase }; A.CallTo(() => _dapperService.List <Product>(A <string> .Ignored, A <object> .Ignored)).Returns(expectedProductsInOrder); // When var products = _getOrderByIdQuery.Run(Constants.IphoneCaseOrder.Id); // Then Assert.Equal(expectedProductsInOrder, products); A.CallTo(() => _dapperService.List <Product>(A <string> .Ignored, A <object> .Ignored)).MustHaveHappened(); }
public IEnumerable <Product> Get(Guid id) { return(_getOrderByIdQuery.Run(id)); }