We are two students who are writing our bachelor's degree, and we have developed a Windows application that should help the restaurant in various communication processes. In fact, he should be able to provide information about the order from the moment the guest was sent, sent to him.
We skipped testing during development, but decided to write unit tests now. However, we found out that the most suitable test that we can write to our system is integration tests, because all the methods in our classes are associated with SQL stored procedures through LINQ to SQL. We know about using stubs to fake database dependencies, but when our database is already implemented with all the functions, we believe that this will give us more benefit for testing several methods together as an integration test.
As you can see from the code below, we tried to follow the guidelines for the unit test, but is this the right way to write an integration test?
[Test] public void SendTotalOrder_SendAllItemsToProducer_OneSentOrder() { //Arrange Order order = new Order(); Guest guest = new Guest(1, order); Producer producer = new Producer("Thomas", "Guldborg", "Beverage producer"); DataGridView dataGridView = new DataGridView { BindingContext = new BindingContext() }; order.MenuItemId = 1; order.Quantity = 1; //Act guest.AddItem(); dataGridView.DataSource = guest.SendOrderOverview(); guest.SendOrder(dataGridView); dataGridView.DataSource = producer.OrderOverview(); var guestTableOrder = producer.OrderOverview() .Where(orders => orders.gtid == guest.GuestTableId) .Select(producerOrder => producerOrder.gtid) .Single(); //Assert Assert.That(guestTableOrder, Is.EqualTo(guest.GuestTableId)); }
c # sql database unit-testing integration-testing
Thomas guldborg
source share