public void ShouldAddNewServices_ReturnNewID()
        {
            SqlLiteDB.SqlLiteDBCreateTableIFNotExist();
            int      servicesID = selectServices.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestServicesID());
            Services services   = new Services()
            {
                services_id   = servicesID,
                services_name = "trwała"
            };
            int lastIndex = addServices.InsertObjectToDB(services);

            Assert.AreEqual(lastIndex, servicesID);
        }
Beispiel #2
0
 public MainForm()
 {
     InitializeComponent();
     SqlLiteDB.SqlLiteDBCreateTableIFNotExist();
     this.selectClient      = new SelectClient();
     this.selectServices    = new SelectServices();
     this.selectReservation = new SelectReservation();
     this.selectEmployee    = new SelectEmployee();
     this.getVReservation   = new CreateViewVreservation(selectClient, selectReservation, selectServices, selectEmployee);
     this.updateClient      = new UpdateClient(selectClient);
     this.deleteReservation = new DeleteReservation();
     this.insertObjectToDB  = new FasadeInsertDB(new DBInsertClient(selectClient), new DBInsertServices(selectServices), new DBInsertReservation(selectReservation),
                                                 new DBInsertEmployee(selectEmployee), new SelectClient(), new SelectServices(), new SelectReservation(), new SelectEmployee());
 }
        public void ShouldAddNewReservation_ReturnNewID()
        {
            SqlLiteDB.SqlLiteDBCreateTableIFNotExist();
            int         reservationID = selectReservation.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestReservationID());
            Reservation reservation   = new Reservation()
            {
                reservation_id   = reservationID,
                reservation_date = new DateTime(2020, 7, 17, 12, 1, 1),
                reservation_time = new TimeSpan(11, 5, 0),
                client_id        = 2,
                services_id      = 2
            };
            int lastIndex = addReservation.InsertObjectToDB(reservation);

            Assert.AreEqual(lastIndex, reservationID);
        }
        public void ShouldAddNewClient_ReturnNewID()
        {
            SqlLiteDB.SqlLiteDBCreateTableIFNotExist();
            int    clientID = selectClient.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestClientID());
            Client client   = new Client()
            {
                client_id          = clientID,
                client_name        = "Julian",
                client_sname       = "Krol",
                client_phone       = "123456789",
                client_description = "test kolejny"
            };
            int lastIndex = addClient.InsertObjectToDB(client);

            Assert.AreEqual(lastIndex, clientID);
        }
        public void ShouldUpdateClient_when_IHaveHisId_returnTrue()
        {
            SqlLiteDB.SqlLiteDBCreateTableIFNotExist();
            //search client
            var clientResult = selectClient.GetRowsForTable(SGetAllRowsFromSpecificTable.ClientSelectAllRowsQuery()).First();
            //get his client_id
            int clientId = clientResult.client_id;
            //change his data
            Client changeClient = new Client()
            {
                client_name        = clientResult.client_name,
                client_sname       = clientResult.client_sname,
                client_phone       = clientResult.client_phone,
                client_description = "zaktualizowny"
            };
            bool result = updateClient.UpdateObject(changeClient, clientId);

            Assert.IsTrue(result);
            //check result
        }