Exemple #1
0
        public void Synchronize_RemovesSubMember(string removed)
        {
            var memberDeclaration = CodeExplorerTestSetup.TestProjectOneDeclarations
                                    .Single(declaration => declaration.IdentifierName.Equals(removed)).ParentDeclaration;

            var declarations         = CodeExplorerTestSetup.TestProjectOneDeclarations.TestMemberDeclarations(memberDeclaration.IdentifierName, out _).ToList();
            var subMemberDeclaration = declarations.Single(declaration => declaration.IdentifierName.Equals(removed));

            var updates = declarations.Except(new List <Declaration> {
                subMemberDeclaration
            }).ToList();

            var member = new CodeExplorerMemberViewModel(null, memberDeclaration, ref declarations);

            var expected = updates.Select(declaration => declaration.QualifiedName.ToString())
                           .OrderBy(_ => _)
                           .ToList();

            member.Synchronize(ref updates);

            var actual = member.GetAllChildDeclarations()
                         .Select(declaration => declaration.QualifiedName.ToString())
                         .OrderBy(_ => _);

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Exemple #2
0
        public void Constructor_PlacesAllTrackedDeclarations(string name, DeclarationType type = DeclarationType.Member)
        {
            var declarations = CodeExplorerTestSetup.TestProjectOneDeclarations.TestMemberDeclarations(name, out var memberDeclaration, type);
            var member       = new CodeExplorerMemberViewModel(null, memberDeclaration, ref declarations);

            var expected = CodeExplorerTestSetup.TestProjectOneDeclarations.TestMemberDeclarations(name, out _, type)
                           .Select(declaration => declaration.QualifiedName.ToString())
                           .OrderBy(_ => _);

            var actual = member.GetAllChildDeclarations()
                         .Select(declaration => declaration.QualifiedName.ToString())
                         .OrderBy(_ => _);

            Assert.IsTrue(expected.SequenceEqual(actual));
        }