public async Task TestGetProductsTestAsync() { // Arrange var logger = LoggingHelper.GetLogger <WarehouseController>(); var service = ServiceMocker.GetWarehouseService(nameof(TestGetProductsTestAsync)); var controller = new WarehouseController(logger, service); // Act var response = await controller.GetProductsAsync() as ObjectResult; var value = response.Value as IPagedResponse <Product>; service.Dispose(); // Assert Assert.False(value.DidError); Assert.True(value.Model.Count() > 0); }
public async Task TestGetProductsAsync() { // Arrange var dbContext = DbContextMocker.GetStoreDbContext(nameof(TestGetProductsAsync)); var service = ServiceMocker.GetWarehouseService(dbContext); var controller = new WarehouseController(service, null); // Act var response = await controller.GetProductsAsync() as ObjectResult; var value = response.Value as IPagedResponse <Product>; service.Dispose(); // Assert Assert.False(value.DidError); Assert.True(value.Model.Count() > 0); }
public async Task GetProductsAsync() { // Arrange var userInfo = IdentityMocker.GetWarehouseOperatorIdentity().GetUserInfo(); var service = ServiceMocker.GetWarehouseService(userInfo, nameof(GetProductsAsync), true); var controller = new WarehouseController(null, service); var request = new GetProductsRequest(); // Act var response = await controller.GetProductsAsync(request) as ObjectResult; var value = response.Value as IPagedResponse <Product>; service.Dispose(); // Assert Assert.False(value.DidError); Assert.True(value.Model.Count() > 0); }