public void IntegratieTest() { UnitOfWork uow = new UnitOfWork(new KlantenBestellingenTestContext(false)); DomainController dc = new DomainController(uow); Action act = () => { Client client = new Client("TestName", "Test5678910"); Client client2 = new Client("Test2", "Tralalalalallalalal"); dc.AddClient(client); dc.AddClient(client2); Client gettedClient = dc.GetClient(2); dc.DeleteClient(gettedClient.Id); Client gettedClient2 = dc.GetClient(1); gettedClient2.Name = "Testeroo"; dc.UpdateClient(gettedClient2); dc.AddClient(client2); Client gettedClient3 = dc.GetClient(3); dc.AddOrder(new Order(Product.Duvel, 10, gettedClient3), gettedClient3.Id); }; act.ShouldNotThrow(); }
public void DeleteClientNormalNoExceptionTest() { //init db UnitOfWork uow = new UnitOfWork(new KlantenBestellingenTestContext(false)); DomainController dc = new DomainController(uow); Client client = new Client("TestName", "Test5678910"); Client gettedClient = dc.AddClient(client);; // Action act = () => dc.DeleteClient(gettedClient.Id); act.ShouldNotThrow(); act = () => dc.GetClient(gettedClient.Id); act.ShouldThrow <Exception>().Message.ShouldBe("Client not in database"); }
public void AddClientNormalNoExceptionsTest() { //init db UnitOfWork uow = new UnitOfWork(new KlantenBestellingenTestContext(false)); DomainController dc = new DomainController(uow); Client client = new Client("TestName", "Test5678910"); Client gettedClient = null; // Action act = () => gettedClient = dc.AddClient(client); act.ShouldNotThrow(); gettedClient.Name.ShouldBe(client.Name); gettedClient.Address.ShouldBe(client.Address); }
public void AddOrderNoExceptionTest() { //init db UnitOfWork uow = new UnitOfWork(new KlantenBestellingenTestContext(false)); DomainController dc = new DomainController(uow); Client client = new Client("TestName", "Test5678910"); dc.AddClient(client); // Client gettedClient = dc.GetClient(1); Order order = new Order(Product.Duvel, 10, gettedClient); Action act = () => dc.AddOrder(order, gettedClient.Id); act.ShouldNotThrow(); }
public void UpdateClientNoExceptionTest() { //init db UnitOfWork uow = new UnitOfWork(new KlantenBestellingenTestContext(false)); DomainController dc = new DomainController(uow); Client client = new Client("TestName", "Test5678910"); dc.AddClient(client); // Client gettedClient = dc.GetClient(1); gettedClient.Name = "Shabalaba"; Action act = () => dc.UpdateClient(gettedClient); act.ShouldNotThrow(); Client updatedClient = dc.GetClient(1); updatedClient.Name.ShouldBe("Shabalaba"); }