Exemplo n.º 1
0
        public SettingsViewModel(IEditorContext editorContext, IStorageController storageController, ITestRunner testRunner, ITelemetryManager telemetryManager, IOptions options, IIoProvider ioProvider)
        {
            _editorContext     = editorContext;
            _storageController = storageController;
            _testRunner        = testRunner;
            _options           = options;
            _ioProvider        = ioProvider;

            _outputDirectories = new ObservableEnumeration <OutputDirectoryViewModel>(() =>
                                                                                      storageController.GetOutputDirectories().Select(p => new OutputDirectoryViewModel(p)), (a, b) => StringComparer.OrdinalIgnoreCase.Compare(a.Name, b.Name));
            _testSettingsFiles = new ObservableEnumeration <string>(() =>
                                                                    (_editorContext?.Solution.FindFiles(new Regex("^.*\\.runSettings$", RegexOptions.Compiled | RegexOptions.IgnoreCase)) ?? new string[0])
                                                                    .Select(p => _ioProvider.GetRelativePath(p)),
                                                                    StringComparer.OrdinalIgnoreCase.Compare);

            editorContext.BuildFinished  += (o, e) => Refresh();
            editorContext.SolutionOpened += (o, e) => Refresh();

            //Fix unsupported state
            if (_options.IsExcludingTestAssemblies && _options.IsCoveringByTest)
            {
                _options.IsExcludingTestAssemblies = false;
                _options.IsCoveringByTest          = false;
            }
        }
Exemplo n.º 2
0
        public void TestGetRelativePath(string input, string output)
        {
            _optionsMock
            .Setup(p => p.SolutionSettingsPath)
            .Returns(@"C:\dev\TheApplication\.AxoCover\settings.json");
            var relativePath = _ioProvider
                               .GetRelativePath(input);

            Assert.AreEqual(output, relativePath);
        }