public void AddProfileValidationTest() { using (mocks.Record()) { // we already have default settings Expect.Call(store.CollectionExists(SolutionSettings)).Return(true); } using (mocks.Playback()) { var settings = new VsSettingsManager(SolutionId, store); settings.AddProfile(String.Empty, String.Empty); } }
public void GetActiveProfileTest() { using (mocks.Record()) { // we already have default settings Expect.Call(store.CollectionExists(SolutionSettings)).Return(true); Expect.Call(store.GetString(SolutionSettings, ActiveProfileProperty)).Return(DefaultProfileName); } using (mocks.Playback()) { var settings = new VsSettingsManager(SolutionId, store); Assert.AreEqual(DefaultProfileName, settings.ActiveProfile); } }
public void CreateDefaultSettingsTest() { var defaultProfileSettings = Path.Combine(SolutionSettings, DefaultProfileName); using (mocks.Record()) { Expect.Call(store.CollectionExists(SolutionSettings)).Return(false); Expect.Call(() => store.CreateCollection(defaultProfileSettings)); Expect.Call(() => store.SetString(SolutionSettings, ActiveProfileProperty, DefaultProfileName)); } using (mocks.Playback()) { var settings = new VsSettingsManager(SolutionId, store); } }
public void SetActiveProfileTest() { var newActiveProfileName = "Some profile"; using (mocks.Record()) { // we already have default settings Expect.Call(store.CollectionExists(SolutionSettings)).Return(true); Expect.Call(() => store.SetString(SolutionSettings, ActiveProfileProperty, newActiveProfileName)); } using (mocks.Playback()) { var settings = new VsSettingsManager(SolutionId, store); settings.ActiveProfile = newActiveProfileName; } }
public void AddProfileThatAlreadyExists() { var newProfileName = "Some profile"; var newProfileSettings = Path.Combine(SolutionSettings, newProfileName); using (mocks.Record()) { // we already have default settings Expect.Call(store.CollectionExists(SolutionSettings)).Return(true); // validation Expect.Call(store.CollectionExists(newProfileSettings)).Return(true); } using (mocks.Playback()) { var settings = new VsSettingsManager(SolutionId, store); settings.AddProfile(newProfileName, String.Empty); } }
public void RemoveNonExistingProfile() { var fakeProfile = "Some fake profile"; var fakeProfileSettings = Path.Combine(SolutionSettings, fakeProfile); using (mocks.Record()) { // we already have default settings Expect.Call(store.CollectionExists(SolutionSettings)).Return(true); // validation Expect.Call(store.CollectionExists(fakeProfileSettings)).Return(false); } using (mocks.Playback()) { var settings = new VsSettingsManager(SolutionId, store); settings.RemoveProfile(fakeProfile); } }
public void RemoveProfileTest() { var defaultProfileSettings = Path.Combine(SolutionSettings, DefaultProfileName); using (mocks.Record()) { // we already have default settings Expect.Call(store.CollectionExists(SolutionSettings)).Return(true); // validation Expect.Call(store.CollectionExists(defaultProfileSettings)).Return(true); // actual delete Expect.Call(store.DeleteCollection(defaultProfileSettings)).Return(true); } using (mocks.Playback()) { var settings = new VsSettingsManager(SolutionId, store); settings.RemoveProfile(DefaultProfileName); } }