internal static IHttpActionResult GetAll() { Insert(); var response = baseController.GetAll(); return(response); }
private void BTNTop10_Click(object sender, EventArgs e) { // För att se hur detta fungerar, gå till StatsForm-klassens dokumentation. StatsForm statsForm = new StatsForm(); statsForm.DrawTop10Graph(productController.GetAll(), receiptController.GetAll()); statsForm.Show(); }
// Fyller listview för kvitton med kvitton. private void ListReceipts() { ListViewReceipts.Items.Clear(); ListViewReceipts.BeginUpdate(); foreach (Receipt receipt in receiptController.GetAll()) { string[] receiptValues = new string[1]; receiptValues[0] = receipt.date; ListViewReceipts.Items.Add(new ListViewItem(receiptValues)); } ListViewReceipts.EndUpdate(); ListViewReceipts.Sort(); }
public async void GetAll_IfAnyExist_ExpectedTrue() { //Arrange var mockContext = new Mock<DataContext>(); mockContext.Setup(x => x.Receipts).ReturnsDbSet(GetReceipts()); var receiptLogger = Mock.Of<ILogger<ReceiptRepository>>(); var receiptRepo = new ReceiptRepository(mockContext.Object, receiptLogger); var driverLogger = Mock.Of<ILogger<DriverRepository>>(); var driverRepo = new DriverRepository(mockContext.Object, driverLogger); var parkingspotLogger = Mock.Of<ILogger<ParkingspotRepository>>(); var parkingspotRepo = new ParkingspotRepository(mockContext.Object, parkingspotLogger); var receiptController = new ReceiptController(receiptRepo, driverRepo, parkingspotRepo); //Act var result = await receiptController.GetAll(); var contentResult = result.Result as OkObjectResult; var resultReceipt = contentResult.Value as Receipt[]; //Assert Assert.True(resultReceipt.Length > 0); }