Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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);
            }
        }
Example #4
0
        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);
            }
        }
Example #6
0
        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);
            }
        }
Example #7
0
        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);
            }
        }
Example #8
0
        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);
            }
        }
        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 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 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 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);
            }
        }
        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 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);
            }
        }