コード例 #1
0
        public void GetWhenNoSettingExist()
        {
            DbSetup();
            var settings = _repository.GetAppSettings();

            Assert.AreEqual(DateTime.Now.Year, settings.CurrentYear);
            Assert.AreEqual(DateTime.Now.Month, settings.CurrentMonth);
            Assert.AreEqual(-1, settings.Id);
        }
コード例 #2
0
        public void GetAppSettings_WhenSettingHasNotSet()
        {
            DbSetup();
            var repositoryCore = new RepositoryCore(new LogService());

            var currentSetting = repositoryCore.GetAppSettings();

            Assert.IsNotNull(currentSetting);
            Assert.AreNotEqual(0, currentSetting.CurrentMonth);
            Assert.AreNotEqual(0, currentSetting.CurrentYear);
        }
コード例 #3
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            ParentViewController.Title = StaticValues.SettingsNavigationTitle;
            var repository = new RepositoryCore(CoreUtilities.GetLogService());

            _appSettings = repository.GetAppSettings();

            handleMonthSelector();
            handleYearSelector();

            Settings_DeleteAllDataBtn.TouchUpInside += Settings_DeleteAllDataBtn_TouchUpInside;
        }
コード例 #4
0
        public void GetAppSettings_WhenSettingHasSetAlready()
        {
            DbSetup();
            var repositoryCore = new RepositoryCore(new LogService());
            var setting        = new Setting();

            setting.CurrentYear  = 2013;
            setting.CurrentMonth = 7;
            setting.Upsert();

            var currentSetting = repositoryCore.GetAppSettings();

            Assert.AreEqual(setting.CurrentMonth, currentSetting.CurrentMonth);
            Assert.AreEqual(setting.CurrentYear, currentSetting.CurrentYear);
        }