public void Synchronize_PlacesAllTrackedDeclarations_AddedComponent(string component, string added) { var declarations = CodeExplorerTestSetup.TestProjectOneDeclarations .TestProjectWithComponentDeclarations(new[] { component }, out var projectDeclaration); var project = new CodeExplorerProjectViewModel(projectDeclaration, ref declarations, null, null, CodeExplorerTestSetup.ProjectOneProvider); var updates = CodeExplorerTestSetup.TestProjectOneDeclarations .TestProjectWithComponentDeclarations(new[] { component, added }, out _).ToList(); var results = updates.ToList(); var expected = CodeExplorerProjectViewModel.ExtractTrackedDeclarationsForProject(projectDeclaration, ref results) .Select(declaration => declaration.QualifiedName.ToString()) .OrderBy(_ => _) .ToList(); project.Synchronize(ref updates); var children = project.GetAllChildDeclarations(); var actual = children .Select(declaration => declaration.QualifiedName.ToString()) .OrderBy(_ => _); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void Constructor_PlacesAllTrackedDeclarations() { var declarations = CodeExplorerTestSetup.TestProjectOneDeclarations; var projectDeclaration = declarations.First(declaration => declaration.DeclarationType == DeclarationType.Project); var results = declarations.ToList(); var project = new CodeExplorerProjectViewModel(projectDeclaration, ref declarations, null, null, CodeExplorerTestSetup.ProjectOneProvider); var expected = CodeExplorerProjectViewModel.ExtractTrackedDeclarationsForProject(projectDeclaration, ref results) .Select(declaration => declaration.QualifiedName.ToString()) .OrderBy(_ => _); var actual = project.GetAllChildDeclarations() .Select(declaration => declaration.QualifiedName.ToString()) .OrderBy(_ => _); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void Synchronize_RemovesComponent(string removed) { var declarations = CodeExplorerTestSetup.TestProjectOneDeclarations; var projectDeclaration = declarations.First(declaration => declaration.DeclarationType == DeclarationType.Project); var project = new CodeExplorerProjectViewModel(projectDeclaration, ref declarations, null, null, CodeExplorerTestSetup.ProjectOneProvider); var updates = CodeExplorerTestSetup.TestProjectOneDeclarations.TestProjectWithComponentRemoved(removed); var expected = updates.Select(declaration => declaration.QualifiedName.ToString()) .OrderBy(_ => _) .ToList(); project.Synchronize(ref updates); var actual = project.GetAllChildDeclarations() .Select(declaration => declaration.QualifiedName.ToString()) .OrderBy(_ => _); Assert.IsTrue(expected.SequenceEqual(actual)); }