Пример #1
0
        public async Task TestSQLServiceGetVacations()
        {
            await InitData();

            VacationsDataService _vacationsDataService = FactorySingleton.FactoryOffline.Get <VacationsDataService>();
            List <VTSModel>      list = await _vacationsDataService.GetVacationListFromSQL();

            Assert.IsNotNull(list, "Error: vacationsDataService.GetVacationListFromSQL() Is Null");
            Assert.AreEqual(list.Count, (new VacationInfoMockModel().Vacations).Count, "Error: list.Count from SQL != VacationInfoMockModel");
        }
Пример #2
0
        public async Task TestSQLServiceDeleteVacation()
        {
            await InitData();

            VacationsDataService _vacationsDataService = FactorySingleton.FactoryOffline.Get <VacationsDataService>();
            List <VTSModel>      list = await _vacationsDataService.GetVacationListFromSQL();

            Assert.IsNotNull(list, "Error: vacationsDataService.GetVacationListFromSQL() Is Null");
            Assert.AreEqual(list.Count, (new VacationInfoMockModel().Vacations).Count, "Error: list.Count from SQL != VacationInfoMockModel");
            VTSModel deletedVTS = list[list.Count - 1];
            int      idDeleted  = deletedVTS.Id;
            await _vacationsDataService.DeleteVacationsInSql(deletedVTS);

            list = await _vacationsDataService.GetVacationListFromSQL();

            Assert.IsNotNull(list, "Error: vacationsDataService.GetVacationListFromSQL() Is Null");
            Assert.AreEqual(list.Count, (new VacationInfoMockModel().Vacations).Count - 1, "Error: list.Count from SQL == VacationInfoMockModel after delete");
            foreach (VTSModel vts in list)
            {
                Assert.AreNotEqual(vts.Id, idDeleted, string.Format("Error:  vacationsDataService.DeleteVacationsInSql ID = {0} deleted item is exist after delete", vts.Id));
            }
        }