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));
        }
Ejemplo n.º 2
0
        public override void UpdateTestResult(TestResult result)
        {
            // Code duplication - taken from NUnitTestProject
            int lastDot = result.Name.LastIndexOf('.');

            if (lastDot < 0)
            {
                return;
            }

            string fixtureName = result.Name.Substring(0, lastDot);
            string memberName  = result.Name.Substring(lastDot + 1);

            var             testClass = GetMSpecTestClass(new FullTypeName(fixtureName)) as MSpecTestClass;
            MSpecTestMember test      = testClass.FindTestMember(memberName);

            if (test != null)
            {
                test.UpdateTestResult(result);
            }
        }