private void FormSaved(object sender, EventArgs e) { var profile = ProfilesProvider.CreateProfile(); profile.RemotingEnabled = _view.Remote.RemotingEnabled; profile.RemoteHost = _view.Remote.RemoteHost; profile.RemoteUsername = _view.Remote.RemoteUsername; profile.RemotePassword = _view.Remote.RemotePassword; profile.RemoteFolder = _view.Remote.RemoteFolder; profile.ProfileName = _view.Profile.ProfileName; profile.Prefix = _view.Profile.Prefix; profile.Webroot = _view.Website?.Webroot ?? ""; if (_view.Website?.SelectedSite != null) { profile.Website = _view.Website.SelectedSite == Settings.Dropdowns.NotSet ? "" : _view.Website.SelectedSite; } profile.Solr = _view.Connectivity == null || _view.Connectivity.Solr == Settings.Dropdowns.NotSet ? "" : _view.Connectivity.Solr; profile.SqlServer = _view.Connectivity == null || _view.Connectivity.Sql == Settings.Dropdowns.NotSet ? "" : _view.Connectivity.Sql; profile.Parameters = _view.Parameters != null ? _view.Parameters.Values : new Dictionary <string, string>(); ProfilesProvider.UpdateSelected(profile); ProfilesProvider.Save(); _view.CloseDialog(); }
public void CreateDummyProfile() { var fakeLocalProfile = ProfilesProvider.CreateLocal(); fakeLocalProfile.ProfileName = Settings.ProfileNotCreated; fakeLocalProfile.Prefix = "Please submit the actual values instead"; ProfilesProvider.Add(fakeLocalProfile); ProfilesProvider.SelectProfile(fakeLocalProfile.ProfileName); }
public void TestProfilesProvider() { var provider = new ProfilesProvider(); var profile = new SerializableDictionary <string, ProfileSettings>(); profile.Add("ABC", new ProfileSettings() { Name = "myName", TeamProject = "myProject" }); provider.Set("dummyUrl", profile); provider.SaveAsJson(_file); var loadedProfiler = new ProfilesProvider(); loadedProfiler.LoadAsJson(_file); CollectionAssert.AreEqual(provider.GetAllProfiles().ToList(), loadedProfiler.GetAllProfiles().ToList()); }