public void Update(ITypeDefinition typeDefinition)
        {
            if (!NestedTestsInitialized)
            {
                return;
            }

            var newOrUpdatedTests = new HashSet <ITest>();

            foreach (ITest test in parentProject.GetTestMembersFor(typeDefinition))
            {
                MSpecTestMember existingTest = FindTestMember(test);
                if (existingTest == null)
                {
                    NestedTestCollection.Add(test);
                    newOrUpdatedTests.Add(test);
                }
                else
                {
                    newOrUpdatedTests.Add(existingTest);
                }
            }

            NestedTestCollection.RemoveAll(t => !newOrUpdatedTests.Contains(t));
        }
 public MSpecTestMember FindTestMember(string name)
 {
     return(NestedTestCollection
            .OfType <MSpecTestMember>()
            .LastOrDefault(member => member.DisplayName == name));
 }