コード例 #1
0
        public void TestLaunchNonExistingEditor()
        {
            FakeConfiguration       fakeConfiguration   = new FakeConfiguration();
            FakeProcessLauncher     fakeProcessLauncher = new FakeProcessLauncher();
            FakeFileSystem          fakeFileSystem      = new FakeFileSystem();
            FakeErrorReporter       fakeErrorReporter   = new FakeErrorReporter();
            ISelectorWindow         fakeSelectorWindow  = new FakeSelectorWindow(fakeProcessLauncher, fakeConfiguration, fakeFileSystem, fakeErrorReporter);
            OccurrenceItemViewModel viewModel           = new OccurrenceItemViewModel(fakeSelectorWindow);

            viewModel.Name           = "abc";
            fakeConfiguration.Editor = "nonExistingEditor";
            viewModel.DoubleClickCommand.Execute(null);
            Assert.AreEqual(fakeErrorReporter.ReportedError, "Configured editor 'nonExistingEditor' is not found.");
        }
コード例 #2
0
        public void TestSetTypoAnalyzerResult()
        {
            IConfiguration          fakeConfiguration   = new FakeConfiguration();
            IProcessLauncher        fakeProcessLauncher = new FakeProcessLauncher();
            IFileSystem             fakeFileSystem      = new FakeFileSystem();
            IErrorReporter          fakeErrorReporter   = new FakeErrorReporter();
            ISelectorWindow         fakeSelectorWindow  = new FakeSelectorWindow(fakeProcessLauncher, fakeConfiguration, fakeFileSystem, fakeErrorReporter);
            SelectorWindowViewModel viewModel           = new SelectorWindowViewModel(fakeSelectorWindow);
            TypoAnalyzerResult      typoAnalyzerResult  = new TypoAnalyzerResult();

            typoAnalyzerResult.AddOccurrence("Hello", "a.cs");
            viewModel.SetTypoAnalyzerResult(typoAnalyzerResult);
            Assert.AreEqual(1, viewModel.Keywords.Count());
        }
コード例 #3
0
        public void TestLaunchExistingEditor()
        {
            FakeConfiguration       fakeConfiguration   = new FakeConfiguration();
            FakeProcessLauncher     fakeProcessLauncher = new FakeProcessLauncher();
            FakeFileSystem          fakeFileSystem      = new FakeFileSystem();
            FakeErrorReporter       fakeErrorReporter   = new FakeErrorReporter();
            ISelectorWindow         fakeSelectorWindow  = new FakeSelectorWindow(fakeProcessLauncher, fakeConfiguration, fakeFileSystem, fakeErrorReporter);
            OccurrenceItemViewModel viewModel           = new OccurrenceItemViewModel(fakeSelectorWindow);

            viewModel.Name           = "abc";
            fakeConfiguration.Editor = "existingEditor";
            viewModel.DoubleClickCommand.Execute(null);
            Assert.AreEqual("existingEditor", fakeProcessLauncher.Executable);
            Assert.AreEqual(@"""abc""", fakeProcessLauncher.Argument);
        }
コード例 #4
0
        public void TestOccurrences()
        {
            IConfiguration          fakeConfiguration   = new FakeConfiguration();
            IProcessLauncher        fakeProcessLauncher = new FakeProcessLauncher();
            IFileSystem             fakeFileSystem      = new FakeFileSystem();
            IErrorReporter          fakeErrorReporter   = new FakeErrorReporter();
            ISelectorWindow         fakeSelectorWindow  = new FakeSelectorWindow(fakeProcessLauncher, fakeConfiguration, fakeFileSystem, fakeErrorReporter);
            SelectorWindowViewModel viewModel           = new SelectorWindowViewModel(fakeSelectorWindow);

            viewModel.Occurrences = null;
            string name = null;

            viewModel.PropertyChanged += (sender, e) => { name = e.PropertyName; };
            viewModel.Occurrences      = new OccurrenceItemViewModel[] { new OccurrenceItemViewModel(fakeSelectorWindow)
                                                                         {
                                                                         } };
            Assert.AreEqual(nameof(viewModel.Occurrences), name);
        }