Exemple #1
0
        public void ShowFileTypeIconsCanBeReset()
        {
            // Arrange

            const bool defaultShowFileTypeIcons = true;

            var repository = new StoredSettingsRepository();

            repository.SetShowFileTypeIcons(false);

            // Act

            repository.Reset();

            // Assert

            var storedValue = repository.GetShowFileTypeIcons();

            Assert.That(storedValue, Is.EqualTo(defaultShowFileTypeIcons));
        }
Exemple #2
0
        public void PathSegmentCountCanBeReset()
        {
            // Arrange

            const int defaultValue = 1;

            var repository = new StoredSettingsRepository();

            repository.SetPathSegmentCount(7);

            // Act

            repository.Reset();

            // Assert

            var storedValue = repository.GetPathSegmentCount();

            Assert.That(storedValue, Is.EqualTo(defaultValue));
        }
Exemple #3
0
        public void AssignProjectColoursCanBeReset()
        {
            // Arrange

            const bool defaultAssignProjectColours = false;

            var repository = new StoredSettingsRepository();

            repository.SetAssignProjectColours(true);

            // Act

            repository.Reset();

            // Assert

            var storedValue = repository.GetAssignProjectColours();

            Assert.That(storedValue, Is.EqualTo(defaultAssignProjectColours));
        }
Exemple #4
0
        public void ShowRecentUsageCanBeReset()
        {
            // Arrange

            const bool defaultShowRecentUsage = false;

            var repository = new StoredSettingsRepository();

            repository.SetShowRecentUsage(true);

            // Act

            repository.Reset();

            // Assert

            var storedValue = repository.GetShowRecentUsage();

            Assert.That(storedValue, Is.EqualTo(defaultShowRecentUsage));
        }
Exemple #5
0
        public void GroupByProjectCanBeReset()
        {
            // Arrange

            const bool defaultGroupByProject = false;

            var repository = new StoredSettingsRepository();

            repository.SetGroupByProject(true);

            // Act

            repository.Reset();

            // Assert

            var storedValue = repository.GetGroupByProject();

            Assert.That(storedValue, Is.EqualTo(defaultGroupByProject));
        }
Exemple #6
0
        public void SelectedDocumentSortTypeCanBeReset()
        {
            // Arrange

            // Value is WorkingFilesList.ToolWindow.Properties.Settings.Default.SelectedDocumentSortType
            const string defaultValue = "WorkingFilesList.ToolWindow.Model.SortOption.AlphabeticalSort";

            var repository = new StoredSettingsRepository();

            repository.SetSelectedDocumentSortType("Testing.SortingOption");

            // Act

            repository.Reset();

            // Assert

            var storedValue = repository.GetSelectedDocumentSortType();

            Assert.That(storedValue, Is.EqualTo(defaultValue));
        }
        public void ResetDoesNotAttemptToDeleteNonExistentSettingsCollection()
        {
            // Arrange

            var settingsStore = Mock.Of <WritableSettingsStore>(s =>
                                                                s.CollectionExists(It.IsAny <string>()) == false);

            var service = Mock.Of <ISettingsStoreService>(s =>
                                                          s.GetSettingsStore(false) == new SettingsStoreContainer(
                                                              Mock.Of <IDisposable>(),
                                                              settingsStore));

            var repository = new StoredSettingsRepository(service, CollectionNameRoot);

            // Act

            repository.Reset();

            // Assert

            Mock.Get(settingsStore).Verify(s => s.DeleteCollection(It.IsAny <string>()),
                                           Times.Never);
        }
        public void ResetDeletesExistingSettingsCollection()
        {
            // Arrange

            var settingsStore = Mock.Of <WritableSettingsStore>(s =>
                                                                s.CollectionExists(It.IsAny <string>()) == true);

            var service = Mock.Of <ISettingsStoreService>(s =>
                                                          s.GetSettingsStore(false) == new SettingsStoreContainer(
                                                              Mock.Of <IDisposable>(),
                                                              settingsStore));

            var repository = new StoredSettingsRepository(service, CollectionNameRoot);

            // Act

            repository.Reset();

            // Assert

            Mock.Get(settingsStore).Verify(s => s.DeleteCollection(
                                               It.Is <string>(name => name == CollectionName)));
        }