コード例 #1
0
ファイル: RunSummary.cs プロジェクト: PKRoma/xunit-codeplex
 /// <summary>
 /// Aggregates the current results with the other results.
 /// </summary>
 /// <param name="other">The other result.</param>
 public void Aggregate(RunSummary other)
 {
     Total += other.Total;
     Failed += other.Failed;
     Skipped += other.Skipped;
     Time += other.Time;
     Continue &= other.Continue;
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestClassCallbackHandler" /> class.
        /// </summary>
        /// <param name="testCases">The test cases that are being run.</param>
        /// <param name="messageSink">The message sink to call with the translated results.</param>
        public TestClassCallbackHandler(IList<Xunit1TestCase> testCases, IMessageSink messageSink)
            : base(lastNodeName: "class")
        {
            this.handlers = new Dictionary<string, Predicate<XmlNode>> { { "class", OnClass }, { "start", OnStart }, { "test", OnTest } };
            this.messageSink = messageSink;
            this.testCases = testCases;
            this.testCaseResults = new RunSummary();

            TestClassResults = new RunSummary();
        }
コード例 #3
0
ファイル: Xunit1.cs プロジェクト: kamchung322/xunit
        RunSummary RunTestCollection(ITestCollection testCollection, IEnumerable<Xunit1TestCase> testCases, IMessageSink messageSink)
        {
            var results = new RunSummary();
            results.Continue = messageSink.OnMessage(new TestCollectionStarting(testCollection));

            if (results.Continue)
                foreach (var testClassGroup in testCases.GroupBy(tc => tc.Class.Name))
                {
                    var classResults = RunTestClass(testCollection, testClassGroup.Key, testClassGroup.ToList(), messageSink);
                    results.Aggregate(classResults);
                    if (!classResults.Continue)
                        break;
                }

            results.Continue = messageSink.OnMessage(new TestCollectionFinished(testCollection, results.Time, results.Total, results.Failed, results.Skipped)) && results.Continue;
            return results;
        }
コード例 #4
0
ファイル: Xunit1.cs プロジェクト: kamchung322/xunit
        /// <summary>
        /// Starts the process of running all the xUnit.net v1 tests.
        /// </summary>
        /// <param name="testCases">The test cases to run; if null, all tests in the assembly are run.</param>
        /// <param name="messageSink">The message sink to report results back to.</param>
        public void Run(IEnumerable<ITestCase> testCases, IMessageSink messageSink)
        {
            var results = new RunSummary();
            var environment = String.Format("{0}-bit .NET {1}", IntPtr.Size * 8, Environment.Version);

            if (messageSink.OnMessage(new TestAssemblyStarting(assemblyFileName, configFileName, DateTime.Now, environment, TestFrameworkDisplayName)))
                foreach (var testCollectionGroup in testCases.Cast<Xunit1TestCase>().GroupBy(tc => tc.TestCollection))
                {
                    var collectionResults = RunTestCollection(testCollectionGroup.Key, testCollectionGroup, messageSink);
                    results.Aggregate(collectionResults);
                    if (!collectionResults.Continue)
                        break;
                }

            messageSink.OnMessage(new TestAssemblyFinished(new Xunit1AssemblyInfo(assemblyFileName), results.Time, results.Total, results.Failed, results.Skipped));
        }