Beispiel #1
0
        private async Task <bool> Save()
        {
            var result = false;

            try
            {
                ShowProgress(_vacationsViewModel.Localaizer.Localize("sending"));
                await Task.Delay(500);

                result = await _vacationsViewModel.SendDraftVacationInfo();

                HideProgress();
            }
            catch (Exception ex)
            {
                AlertDialog(ex.Message, null);
                HideProgress();
                return(false);
            }
            Intent myIntent = new Intent(this, typeof(MainScreenActivity));

            SetResult(Result.Ok, myIntent);
            Exit();
            return(true);
        }
Beispiel #2
0
        public async Task IntegrationCreateVacation()
        {
            VacationsViewModel vacationsViewModel = (onlineMode) ? FactorySingleton.Factory.Get <VacationsViewModel>() : FactorySingleton.FactoryOffline.Get <VacationsViewModel>();
            List <VTSModel>    vtsList            = await vacationsViewModel.GetVTSList();

            Assert.IsNotNull(vtsList, "Message: GetVTSList error");

            VacationInfoModel vacationInfo = await vacationsViewModel.GetVacationInfo(vtsList[0].Id);

            Assert.IsNotNull(vacationInfo, "Message: GetVacationInfo error");

            var oldcount = vtsList.Count;
            VacationInfoModel vacationInfoNew = await vacationsViewModel.CreateDraftVacationInfo();

            Assert.IsNotNull(vacationInfoNew, "Message: CreateDraftVacationInfo error");
            vacationInfoNew.Type.Value = "TESTING";
            await vacationsViewModel.UpdateDraftVacationInfo(vacationInfoNew);

            if (onlineMode)
            {
                Assert.IsTrue((await vacationsViewModel.SendDraftVacationInfo()), "Message: error SendDraftVacationInfo");
                vtsList = await vacationsViewModel.GetVTSList();

                Assert.AreEqual(vtsList.Count, (oldcount + 1), "Message: error after Create newcount != oldcount + 1");
                VacationInfoModel vacationInfoSaved = await vacationsViewModel.GetVacationInfo(vtsList[vtsList.Count - 1].Id);

                Assert.IsNotNull(vacationInfoSaved, "Message: GetVacationInfo2 error");
                Assert.AreEqual(vacationInfoNew.Type.Value, vacationInfoSaved.Type.Value, "Message: error vacationInfoNew not Equals Type.Value vacationInfoSaved");
            }
        }