public RefundForm() { InitializeComponent(); receiptController = new ReceiptController(); productController = new ProductController(); ListReceipts(); }
private String setUp() { receiptController = new ReceiptController(); ReceiptController.processOrders(orders_json); ReceiptController.processPayments(payments_json); ReceiptController.processPrices(prices_json); return(receiptController.GetReceipts()); }
public RateForm(User user, ReceiptController controller) { InitializeComponent(); Values.Text = "USD"; Values.Height = Sum.Height; actualUser = user; receiptController = controller; }
static void Main(string[] args) { ReceiptController receiptController = new ReceiptController(); receiptController.setUp(); // function that reads the files then calls the controller endpoints String jsonResult = receiptController.GetReceipts(); // function to get the expected result Console.WriteLine(jsonResult); }
public MainForm() { InitializeComponent(); productController = new ProductController(); receiptController = new ReceiptController(); cartProducts = new List <Product>(); ListProducts(productController.GetAll()); ListProductTypesInComboBox(ComboBoxSearchProductTypes); }
static ReceiptImplementaion() { //Arrange baseController = new ReceiptController { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; }
public void ReceiptControllerTest() { Dictionary <string, decimal> sample = new Dictionary <string, decimal>() { { "APPLE", 0.50m }, { "ORANGE", 0.70m }, { "BANANA", 0.82m } }; PriceCatalog catalog = new PriceCatalog(sample); Receipt model = new Receipt(catalog); ReceiptView view = new ReceiptView(); ReceiptController controller = new ReceiptController(view, model); Assert.IsNotNull(controller); }
public void GetPriceOfReceiptItemTest() { Dictionary <string, decimal> sample = new Dictionary <string, decimal>() { { "APPLE", 0.50m }, { "ORANGE", 0.70m }, { "BANANA", 0.82m } }; PriceCatalog catalog = new PriceCatalog(sample); ReceiptView view = new ReceiptView(); Receipt model = new Receipt(catalog); model.AddOrUpdateItem("APPLE"); ReceiptController controller = new ReceiptController(view, model); Assert.AreEqual(controller.GetPriceOfReceiptItem("APPLE"), 0.50m); }
public async void CreateReceipt_IfCreateReceipt_Expected201StatusCode() { //Arrange var receiptRepo = new Mock<IReceiptRepository>(); receiptRepo.Setup(x => x.Save()).Returns(Task.FromResult(true)); var driverRepo = new Mock<IDriverRepository>(); var parkingspotRepo = new Mock<IParkingspotRepository>(); var receiptController = new ReceiptController(receiptRepo.Object, driverRepo.Object, parkingspotRepo.Object); //Act var createdResult = await receiptController.CreateReceipt(new PostReceipt { DriverId = new Driver { DriverId = 1 }.DriverId, ParkingspotId = new Parkingspot { ParkingspotId = 1 }.ParkingspotId }); var contentResult = createdResult.Result as CreatedResult; //Assert Assert.Equal(201, contentResult.StatusCode); }
public async void GetReceiptById_IfExist_ExpectedNotNull() { //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.GetReceiptById(1); var contentResult = result.Result as OkObjectResult; var resultReceipt = contentResult.Value as Receipt; //Assert Assert.NotNull(resultReceipt); }