public void Update(TestProjectSettings testProjectSettings)
        {
            CoverageSettings settings = Read();

            var currentProjectSettings = settings.Projects.FirstOrDefault(x => x.Name == testProjectSettings.Name);
            settings.Projects.Remove(currentProjectSettings);
            settings.Projects.Add(testProjectSettings);

            Update(settings);
        }
        public async Task ShouldNot_TestProjectTestProjectsStoredInFile_When_StoredSettingsAreAvailable_And_SolutionDoesContainsThatProject()
        {
            // arrange
            var coverageSettings = new CoverageSettings();
            var testProjectSettings = new TestProjectSettings();
            coverageSettings.Projects.Add(testProjectSettings);
            _settingsStoreMock.Read().Returns(coverageSettings);

            testProjectSettings.IsCoverageEnabled = true;
            testProjectSettings.Name = "foo";

            var workspace = new AdhocWorkspace();
            _testExtractorMock.GetTestClasses(Arg.Any<SyntaxNode>()).Returns(new ClassDeclarationSyntax[0]);
            _solutionExplorerMock.Solution.Returns(workspace.CurrentSolution);

            // act
            TestProject[] projects = await _sut.GetAllTestProjectsAsync();

            // assert
            Assert.That(projects.Length, Is.EqualTo(0));
        }
        public async Task Should_ReturnUnignoredTestProject_When_StoredSettingsAreAvailable_And_SolutionContainsThatProject()
        {
            // arrange
            var coverageSettings = new CoverageSettings();
            var testProjectSettings = new TestProjectSettings();
            coverageSettings.Projects.Add(testProjectSettings);
            _settingsStoreMock.Read().Returns(coverageSettings);

            testProjectSettings.IsCoverageEnabled = true;
            testProjectSettings.Name = "foo";

            var workspace = new AdhocWorkspace();
            var project = workspace.AddProject("foo", LanguageNames.CSharp);
            var testClass = CSharpSyntaxTree.ParseText(@"[TestFixtureViewModel]class MathHelperTests{ [Test]void Test(){}}");

            workspace.AddDocument(project.Id, "MathHelperTests.cs", SourceText.From(testClass.ToString()));

            _testExtractorMock.GetTestClasses(Arg.Any<SyntaxNode>()).Returns(new[] { testClass.GetRoot().GetClassDeclarationSyntax() });
            _solutionExplorerMock.Solution.Returns(workspace.CurrentSolution);

            // act
            TestProject[] projects = await _sut.GetAllTestProjectsAsync();

            // assert
            Assert.That(projects.Length, Is.EqualTo(1));
            Assert.That(projects[0].Project.Name, Is.EqualTo("foo"));
            Assert.IsTrue(projects[0].IsCoverageEnabled);
        }