Beispiel #1
0
        internal static IHttpActionResult GetAll()
        {
            Insert();
            var response = baseController.GetAll();

            return(response);
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 // 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);
        }