예제 #1
0
        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();
        }
예제 #2
0
        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");
        }
예제 #3
0
        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);
        }
예제 #4
0
        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();
        }
예제 #5
0
        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");
        }