public static void TestGetOrder() { // Arrange var dbContext = DbContextMock.GetApplicationDBContext(nameof(TestGetOrders)); RepositoryWrap repositoryWrap = new RepositoryWrap(dbContext); var controller = new OrderController(repositoryWrap); var orderID = 1; // Act var response = controller.GetOrderById(orderID) as ObjectResult; var value = response.Value as Order; dbContext.Dispose(); // Assert Assert.NotNull(value); }
public static void TestGetOrders() { // Arrange var dbContext = DbContextMock.GetApplicationDBContext(nameof(TestGetOrders)); RepositoryWrap repositoryWrap = new RepositoryWrap(dbContext); var controller = new OrderController(repositoryWrap); // Act var response = controller.GetOrders() as ObjectResult; var value = response.Value as IQueryable <Order>; dbContext.Dispose(); // Assert Assert.NotEmpty(value); }