Пример #1
0
        void Find(Predicate <ITestCaseDiscoveryMessage> filter, bool includeSourceInformation, IMessageSink messageSink)
        {
            try
            {
                XmlNode assemblyXml = null;

                var handler = new XmlNodeCallbackHandler(xml => { assemblyXml = xml; return(true); });
                executor.EnumerateTests(handler);

                foreach (XmlNode method in assemblyXml.SelectNodes("//method"))
                {
                    var testCase = method.ToTestCase(assemblyFileName, configFileName);
                    if (testCase != null)
                    {
                        if (includeSourceInformation)
                        {
                            testCase.SourceInformation = sourceInformationProvider.GetSourceInformation(testCase);
                        }

                        var message = new TestCaseDiscoveryMessage(testCase);
                        if (filter(message))
                        {
                            messageSink.OnMessage(message);
                        }
                    }
                }
            }
            finally
            {
                messageSink.OnMessage(new DiscoveryCompleteMessage(new string[0]));
            }
        }
Пример #2
0
        void Find(Predicate<ITestCaseDiscoveryMessage> filter, bool includeSourceInformation, IMessageSink messageSink)
        {
            try
            {
                XmlNode assemblyXml = null;

                using (var handler = new XmlNodeCallbackHandler(xml => { assemblyXml = xml; return true; }))
                    executor.EnumerateTests(handler);

                foreach (XmlNode method in assemblyXml.SelectNodes("//method"))
                {
                    var testCase = method.ToTestCase(assemblyFileName);
                    if (testCase != null)
                    {
                        if (includeSourceInformation)
                            testCase.SourceInformation = sourceInformationProvider.GetSourceInformation(testCase);

                        testCase.TestCollection = testCollection;

                        var message = new TestCaseDiscoveryMessage(testCase);
                        if (filter(message))
                            messageSink.OnMessage(message);
                    }
                }
            }
            finally
            {
                messageSink.OnMessage(new DiscoveryCompleteMessage(new string[0]));
            }
        }