public void CreationTest()
 {
     SettingsViewModel settingsViewModel = new SettingsViewModel();
     Assert.AreEqual(0, settingsViewModel.BusyCount);
     Assert.IsFalse(settingsViewModel.IsBusy);
     Assert.IsTrue(settingsViewModel.InitializeViewModelCommand.CanExecute(null));
 }
        public void ChangeSettingsTest()
        {
            bool isTestCompleted = false;
            bool wasInitialization = false;
            SettingsViewModel settingsVm = new SettingsViewModel();
            settingsVm.TestCompleted += (sender, args) =>
            {
                if (args.Message == REFRESH_ENDED)
                {
                    if (!wasInitialization)
                    {
                        var defaultSettings = settingsRespository.GetDefaultSettings();
                        Assert.AreEqual(defaultSettings.PhotoResolutionID, settingsVm.SelectedResolution.ID);
                        Assert.AreEqual(defaultSettings.LanguageID, settingsVm.CurrentLanguage.ID);
                        Assert.AreEqual(defaultSettings.IsGpsEnabled, settingsVm.IsGpsEnabled);
                        Assert.AreEqual(defaultSettings.CheckForNewSurveys, settingsVm.IsCheckForNewSurveysOnStart);

                        settingsVm.IsGpsEnabled = false;
                        settingsVm.IsCheckForNewSurveysOnStart = false;
                        settingsVm.SelectedResolution = settingsVm.Resolutions[1];
                        settingsVm.CurrentLanguage = settingsVm.Languages[0];
                        wasInitialization = true;

                        settingsVm.SaveSettingsCommand.Execute(null);
                    }
                    else
                    {
                        var currentSettings = settingsRespository.GetCurrentSettings();
                        Assert.AreEqual(settingsVm.IsCheckForNewSurveysOnStart, currentSettings.CheckForNewSurveys);
                        Assert.AreEqual(settingsVm.IsGpsEnabled, currentSettings.IsGpsEnabled);
                        Assert.AreEqual(settingsVm.CurrentLanguage.ID, currentSettings.LanguageID);
                        Assert.AreEqual(settingsVm.SelectedResolution.ID, currentSettings.PhotoResolutionID);
                        Assert.AreEqual(false, currentSettings.IsDefault);

                        settingsRespository.ResetCurrentSettings();

                        CallTestComplete(ref isTestCompleted);
                    }
                }
            };

            settingsVm.InitializeViewModelCommand.Execute(null);
            EndOnWaitingResponse();
        }
        public void InitializationSettingsTest()
        {
            bool isTestCompleteCalled = false;
            SettingsViewModel settings = new SettingsViewModel();
            settings.TestCompleted += (sender, args) =>
            {
                if (args.Message == REFRESH_ENDED)
                {
                    var defaultSettings = settingsRespository.GetDefaultSettings();
                    Assert.AreEqual(defaultSettings.PhotoResolutionID, settings.SelectedResolution.ID);
                    Assert.AreEqual(defaultSettings.LanguageID, settings.CurrentLanguage.ID);
                    Assert.AreEqual(defaultSettings.IsGpsEnabled, settings.IsGpsEnabled);
                    Assert.AreEqual(defaultSettings.CheckForNewSurveys, settings.IsCheckForNewSurveysOnStart);
                    CallTestComplete(ref isTestCompleteCalled);
                }
            };

            settings.InitializeViewModelCommand.Execute(null);
            EndOnWaitingResponse();
        }
 private static void ClearSettings()
 {
     settingsStatic = null;
 }