コード例 #1
0
        public void Initialize()
        {
#if DATAFILES_TARGET_20 || DATAFILES_TARGET_30
            DotNetSettings.UseDefaultQualifiedNameConverter(false);
#else
            DotNetSettings.QualifiedNameConverter = null;
#endif
        }
コード例 #2
0
        public void Cleanup()
        {
#if DATAFILES_TARGET_20 || DATAFILES_TARGET_30
            DotNetSettings.UseDefaultQualifiedNameConverter(true);
#else
            DotNetSettings.QualifiedNameConverter = DotNetSettings.DefaultQualifiedNameConverter;
#endif
        }
コード例 #3
0
        public void Test_OpenFiles_Initialization_WhenNull()
        {
            // Arrange.
            settings.OpenFiles = null;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act.
            var actual = appSettings.OpenFiles;

            // Assert.
            Assert.Empty(actual);
        }
コード例 #4
0
        public void Test_RecentFiles_Initialization_WhenNull()
        {
            // Arrange.
            settings.RecentFiles = null;

            var appSettings = new DotNetSettings(settings);

            // Act.
            var actual = appSettings.RecentFiles;

            // Assert.
            Assert.Empty(actual);
        }
コード例 #5
0
        public void Test_RecentFiles_Initialization_WhenEmpty()
        {
            // Arrange.
            settings.RecentFiles = new StringCollection();

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act.
            var actual = appSettings.RecentFiles;

            // Assert.
            Assert.Empty(actual);
        }
コード例 #6
0
        public void Test_OpenFiles_Initialization_WhenEmpty()
        {
            // Arrange.
            settings.OpenFiles = new StringCollection();

            var appSettings = new DotNetSettings(settings);

            // Act.
            var actual = appSettings.OpenFiles;

            // Assert.
            Assert.Empty(actual);
        }
コード例 #7
0
        public void Test_LastDiagramLocation_Initialization(string expected, string lastPath)
        {
            // Arrange.
            settings.LastPath = lastPath;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act.
            var actual = appSettings.LastDiagramLocation.FullName;

            // Assert.
            Assert.Equal(expected, actual);
        }
コード例 #8
0
        public void Test_Initialization()
        {
            // Arrange.
            settings.RememberOpenFiles              = true;
            settings.MaximumRecentFiles             = 15;
            settings.AutoSaveEnabled                = true;
            settings.AutoSaveInterval               = TimeSpan.FromSeconds(15);
            settings.HighlightCurrentLine           = true;
            settings.ShowLineNumbers                = true;
            settings.EnableVirtualSpace             = true;
            settings.EnableWordWrap                 = true;
            settings.EmptySelectionCopiesEntireLine = true;
            settings.AllowScrollingBelowContent     = true;
            settings.LastPath = @"C:\";

            // Act.
            var appSettings = new DotNetSettings(settings);

            // Assert.
            Assert.Equal(settings.LastPath, appSettings.LastDiagramLocation.FullName);

            Assert.Equal(settings.GraphVizLocation, appSettings.GraphVizExecutable.FullName);
            Assert.Equal(Path.GetFullPath(settings.PlantUmlLocation), appSettings.PlantUmlJar.FullName);
            Assert.Equal(Path.GetFullPath(settings.PlantUmlHighlightingDefinition), appSettings.PlantUmlHighlightingDefinition.FullName);

            Assert.Equal(settings.GraphVizLocalVersionPattern, appSettings.GraphVizLocalVersionPattern.ToString());
            Assert.Equal(settings.GraphVizRemoteVersionPattern, appSettings.GraphVizRemoteVersionPattern.ToString());

            Assert.Equal(settings.GraphVizVersionSource, appSettings.GraphVizVersionSource);
            Assert.Equal(settings.GraphVizDownloadLocation, appSettings.GraphVizDownloadLocation);

            Assert.Equal(settings.PlantUmlLocalVersionPattern, appSettings.PlantUmlLocalVersionPattern.ToString());
            Assert.Equal(settings.PlantUmlRemoteVersionPattern, appSettings.PlantUmlRemoteVersionPattern.ToString());

            Assert.Equal(settings.PlantUmlVersionSource, appSettings.PlantUmlVersionSource);
            Assert.Equal(settings.PlantUmlDownloadLocation, appSettings.PlantUmlDownloadLocation);

            Assert.Equal(settings.PlantUmlFileExtension, appSettings.DiagramFileExtension);

            Assert.Equal(settings.RememberOpenFiles, appSettings.RememberOpenFiles);
            Assert.Equal(settings.MaximumRecentFiles, appSettings.MaximumRecentFiles);
            Assert.Equal(settings.AutoSaveEnabled, appSettings.AutoSaveEnabled);
            Assert.Equal(settings.AutoSaveInterval, appSettings.AutoSaveInterval);

            Assert.Equal(settings.HighlightCurrentLine, appSettings.HighlightCurrentLine);
            Assert.Equal(settings.ShowLineNumbers, appSettings.ShowLineNumbers);
            Assert.Equal(settings.EnableVirtualSpace, appSettings.EnableVirtualSpace);
            Assert.Equal(settings.EnableWordWrap, appSettings.EnableWordWrap);
            Assert.Equal(settings.EmptySelectionCopiesEntireLine, appSettings.EmptySelectionCopiesEntireLine);
            Assert.Equal(settings.AllowScrollingBelowContent, appSettings.AllowScrollingBelowContent);
        }
コード例 #9
0
        public void Test_EnableVirtualSpace_Changes()
        {
            // Arrange.
            settings.EnableVirtualSpace = false;

            var appSettings = new DotNetSettings(settings);

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.EnableVirtualSpace,
                                       () => appSettings.EnableVirtualSpace = true);

            Assert.True(appSettings.EnableVirtualSpace);
        }
コード例 #10
0
        public void Test_LastDiagramLocation_Changes()
        {
            // Arrange.
            settings.LastPath = @"C:\Initial";

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.LastDiagramLocation,
                                       () => appSettings.LastDiagramLocation = new DirectoryInfo(@"C:\New"));

            Assert.Equal(@"C:\New", appSettings.LastDiagramLocation.FullName);
        }
コード例 #11
0
        public void Test_AllowScrollingBelowContent_Changes()
        {
            // Arrange.
            settings.AllowScrollingBelowContent = false;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.AllowScrollingBelowContent,
                                       () => appSettings.AllowScrollingBelowContent = true);

            Assert.True(appSettings.AllowScrollingBelowContent);
        }
コード例 #12
0
        public void Test_EnableWordWrap_Changes()
        {
            // Arrange.
            settings.EnableWordWrap = false;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.EnableWordWrap,
                                       () => appSettings.EnableWordWrap = true);

            Assert.True(appSettings.EnableWordWrap);
        }
コード例 #13
0
        public void Test_EmptySelectionCopiesEntireLine_Changes()
        {
            // Arrange.
            settings.EmptySelectionCopiesEntireLine = false;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.EmptySelectionCopiesEntireLine,
                                       () => appSettings.EmptySelectionCopiesEntireLine = true);

            Assert.True(appSettings.EmptySelectionCopiesEntireLine);
        }
コード例 #14
0
        public void Test_HighlightCurrentLine_Changes()
        {
            // Arrange.
            settings.HighlightCurrentLine = false;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.HighlightCurrentLine,
                                       () => appSettings.HighlightCurrentLine = true);

            Assert.True(appSettings.HighlightCurrentLine);
        }
コード例 #15
0
        public void Test_ShowLineNumbers_Changes()
        {
            // Arrange.
            settings.ShowLineNumbers = false;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.ShowLineNumbers,
                                       () => appSettings.ShowLineNumbers = true);

            Assert.True(appSettings.ShowLineNumbers);
        }
コード例 #16
0
        public void Test_AutoSaveEnabled_Changes()
        {
            // Arrange.
            settings.AutoSaveEnabled = false;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.AutoSaveEnabled,
                                       () => appSettings.AutoSaveEnabled = true);

            Assert.True(appSettings.AutoSaveEnabled);
        }
コード例 #17
0
        public void Test_TfsServerLocation_Changes()
        {
            // Arrange.
            settings.TFSServerUrl = new Uri("http://testserver/");

            var appSettings = new DotNetSettings(settings);

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.TfsServerLocation,
                                       () => appSettings.TfsServerLocation = new Uri("http://testserver2/"));

            Assert.Equal("http://testserver2/", appSettings.TfsServerLocation.ToString());
        }
コード例 #18
0
        public void Test_MaximumRecentFiles_Changes()
        {
            // Arrange.
            settings.MaximumRecentFiles = 5;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.MaximumRecentFiles,
                                       () => appSettings.MaximumRecentFiles = 15);

            Assert.Equal(15, appSettings.MaximumRecentFiles);
        }
コード例 #19
0
        public void Test_RememberOpenFiles_Changes()
        {
            // Arrange.
            settings.RememberOpenFiles = true;

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.RememberOpenFiles,
                                       () => appSettings.RememberOpenFiles = false);

            Assert.False(appSettings.RememberOpenFiles);
        }
コード例 #20
0
        public void Test_TfsProjectName_Changes()
        {
            // Arrange.
            _settings.TFSProjectName = "project1";

            var appSettings = new DotNetSettings(_settings);

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.TfsProjectName,
                                       () => appSettings.TfsProjectName = "project2");

            Assert.Equal("project2", appSettings.TfsProjectName);
        }
コード例 #21
0
        public void Test_AutoSaveInterval_Changes()
        {
            // Arrange.
            settings.AutoSaveInterval = TimeSpan.FromSeconds(0);

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.AutoSaveInterval,
                                       () => appSettings.AutoSaveInterval = TimeSpan.FromSeconds(30));

            Assert.Equal(TimeSpan.FromSeconds(30), appSettings.AutoSaveInterval);
        }
コード例 #22
0
        public void Test_Initialization()
        {
            // Arrange.
            settings.TFSServerUrl   = new Uri("http://testserver/");
            settings.TFSProjectName = "project1";
            settings["TestDiscoveryPluginLocation"] = @"C:\Plugins";

            // Act.
            var appSettings = new DotNetSettings(settings);

            // Assert.
            Assert.Equal("http://testserver/", appSettings.TfsServerLocation.ToString());
            Assert.Equal("project1", appSettings.TfsProjectName);
            Assert.Equal(@"C:\Plugins", appSettings.TestDiscoveryPluginLocation.FullName);
        }
コード例 #23
0
        public void Test_OpenFiles_Changes()
        {
            // Arrange.
            settings.OpenFiles = new StringCollection {
                @"C:\file1"
            };

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act/Assert.
            AssertThat.PropertyChanged(appSettings,
                                       s => s.OpenFiles,
                                       () => appSettings.OpenFiles = new [] { new FileInfo(@"C:\file1"), new FileInfo(@"C:\file2") });

            AssertThat.SequenceEqual(new[] { @"C:\file1", @"C:\file2" }, appSettings.OpenFiles.Select(f => f.FullName));
        }
コード例 #24
0
        public void Test_RecentFiles_Initialization_WhenPopulated()
        {
            // Arrange.
            settings.RecentFiles = new StringCollection();
            settings.RecentFiles.AddRange(new[] { @"C:\file1", @"C:\file2" });

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act.
            var actual = appSettings.RecentFiles;

            // Assert.
            Assert.NotEmpty(actual);
            Assert.Equal(2, actual.Count);
            AssertThat.SequenceEqual(actual.Select(f => f.FullName), new[] { @"C:\file1", @"C:\file2" });
        }
コード例 #25
0
        public void Test_OpenFiles_Preserves_InsertionOrder()
        {
            // Arrange.
            settings.OpenFiles = new StringCollection();
            var files = new[] { @"C:\fileC", @"C:\fileA", @"C:\fileB" }.Select(f => new FileInfo(f)).ToList();

            var appSettings = new DotNetSettings(settings);

            // Act.
            foreach (var file in files)
            {
                appSettings.OpenFiles.Add(file);
            }

            // Assert.
            AssertThat.SequenceEqual(appSettings.OpenFiles, files, FileSystemInfoPathEqualityComparer.Instance);
        }
コード例 #26
0
        public void Test_OpenFiles_Preserves_InsertionOrder()
        {
            // Arrange.
            settings.OpenFiles = new StringCollection();
            var files = new[] { new FileInfo(@"C:\fileC"), new FileInfo(@"C:\fileA"), new FileInfo(@"C:\fileB") };

            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"));

            // Act.
            foreach (var file in files)
            {
                appSettings.OpenFiles.Add(file);
            }

            // Assert.
            AssertThat.SequenceEqual(appSettings.OpenFiles, files, FileInfoPathEqualityComparer.Instance);
        }
コード例 #27
0
        public void Test_Save_OpenFiles_EvenWhen_OpenFilesNotRemembered()
        {
            // Arrange.
            var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\"))
            {
                RememberOpenFiles = false,
                OpenFiles         = new List <FileInfo> {
                    new FileInfo(@"C:\openFile1"), new FileInfo(@"C:\openFile2")
                },
            };

            // Act.
            appSettings.Save();

            // Assert.
            AssertThat.SequenceEqual(settings.OpenFiles.Cast <string>(), new[] { @"C:\openFile1", @"C:\openFile2" });
        }
コード例 #28
0
        public void Test_Save()
        {
            // Arrange.
            var appSettings = new DotNetSettings(settings)
            {
                TfsServerLocation = new Uri("http://testserver/"),
                TfsProjectName    = "project1"
            };

            appSettings.TfsServerLocation = new Uri("http://testserver2/");
            appSettings.TfsProjectName    = "project2";

            // Act.
            appSettings.Save();

            // Assert.
            Assert.Equal("http://testserver2/", settings.TFSServerUrl.ToString());
            Assert.Equal("project2", settings.TFSProjectName);
        }
コード例 #29
0
        public void Test_Initialization()
        {
            // Arrange.
            _settings.TFSServerUrls = new StringCollection {
                "http://testserver/"
            };
            _settings.TFSProjectName                 = "project1";
            _settings.AutoConnectOnStartup           = false;
            _settings["TestDiscoveryPluginLocation"] = @"C:\Plugins";

            // Act.
            var appSettings = new DotNetSettings(_settings);

            // Assert.
            AssertThat.SequenceEqual(new [] { new Uri("http://testserver/") }, appSettings.TfsServers);
            Assert.Equal("project1", appSettings.TfsProjectName);
            Assert.False(appSettings.AutoConnectOnStartup);
            Assert.Equal(@"C:\Plugins", appSettings.TestDiscoveryPluginLocation.FullName);
        }
コード例 #30
0
        public void Test_Save()
        {
            // Arrange.
            var appSettings = new DotNetSettings(settings)
            {
                RememberOpenFiles = true,
                OpenFiles         = new List <FileInfo> {
                    new FileInfo(@"C:\openFile1"), new FileInfo(@"C:\openFile2")
                },
                MaximumRecentFiles             = 20,
                AutoSaveEnabled                = true,
                AutoSaveInterval               = TimeSpan.FromSeconds(15),
                HighlightCurrentLine           = false,
                ShowLineNumbers                = false,
                EnableVirtualSpace             = true,
                EnableWordWrap                 = true,
                EmptySelectionCopiesEntireLine = false,
                AllowScrollingBelowContent     = true,
                LastDiagramLocation            = new DirectoryInfo(@"C:\")
            };

            appSettings.RecentFiles.AddRange(new FileInfo(@"C:\recentFile1"), new FileInfo(@"C:\recentFile2"));

            // Act.
            appSettings.Save();

            // Assert.
            Assert.Equal(true, settings.RememberOpenFiles);
            AssertThat.SequenceEqual(settings.OpenFiles.Cast <string>(), new[] { @"C:\openFile1", @"C:\openFile2" });
            Assert.Equal(20, settings.MaximumRecentFiles);
            AssertThat.SequenceEqual(settings.RecentFiles.Cast <string>(), new[] { @"C:\recentFile2", @"C:\recentFile1" });
            Assert.Equal(true, settings.AutoSaveEnabled);
            Assert.Equal(TimeSpan.FromSeconds(15), settings.AutoSaveInterval);
            Assert.Equal(false, settings.HighlightCurrentLine);
            Assert.Equal(false, settings.ShowLineNumbers);
            Assert.Equal(true, settings.EnableVirtualSpace);
            Assert.Equal(true, settings.EnableWordWrap);
            Assert.Equal(false, settings.EmptySelectionCopiesEntireLine);
            Assert.Equal(true, settings.AllowScrollingBelowContent);
            Assert.Equal(@"C:\", settings.LastPath);
        }