public void Test_Return_Message_When_NotFound_SaleController_GetAll() { var fakeContext = new FakeContext("Return_Message_When_NotFound_SaleController_GetAll"); fakeContext.FillWith <Product>(); using (var context = new MainContext(fakeContext.FakeOptions, fakeContext.FakeConfiguration().Object)) { var repository = new SaleRepository(context); var productRepository = new ProductRepository(context); var updateMock = new Mock <IUpdateProduct>(); updateMock .Setup(x => x.UpdateStock(It.IsAny <Sale>(), It.IsAny <Sale>())); var messageMock = new Mock <IMessageHandler>(); messageMock .Setup(x => x .SendMessageAsync(It.IsAny <MessageType>(), It.IsAny <Sale>(), It.IsAny <UpdatedSale>())) .Returns(Task.CompletedTask); var service = new SaleService(repository, messageMock.Object, updateMock.Object, productRepository); var controller = new SaleController(service); var response = controller.GetAll(); var okResult = response as NotFoundObjectResult; var resultValue = okResult.Value; Assert.NotNull(okResult); Assert.Equal(404, okResult.StatusCode); } }
public SaleStats() { InitializeComponent(); saleController = new SaleController(); statisticController = new StatisticController(); List <Sale> lst = saleController.GetAll(); dgvSales.DataSource = lst; chSales.Series.Add(statisticController.GetStatisticalData(lst)); }
private void LoadStatisticalData() { chQuotesAndSales.Series.Add(statisticController.GetStatisticalData(quoteController.GetAll())); chQuotesAndSales.Series.Add(statisticController.GetStatisticalData(saleController.GetAll())); chNewCustomers.Series.Add(statisticController.GetStatisticalData(customerController.GetAll())); }