public void ResultsAndDurationsAreSetAndPropagatedCorrectly() { var testEvent = new TestRunEvent { Tests = { new TestCaseResult { TestMethod = TestMethod1, Result = TestResult.Success, Duration = TimeSpan.FromSeconds(0.1) }, new TestCaseResult { TestMethod = TestMethod2, Result = TestResult.Failed, Duration = TimeSpan.FromSeconds(0.2) } } }; var sut = new TestRunIntervalTransformer(_context); sut.ProcessEvent(testEvent); var actual = sut.SignalEndOfEventStream().First(); Assert.AreEqual("TestProj1", actual.ProjectName); Assert.AreEqual(1, actual.TestClasses.Count); Assert.AreEqual(TimeSpan.FromSeconds(0.3), actual.Duration); Assert.AreEqual(TestResult.Failed, actual.Result); Assert.AreEqual("Test.TestClass", actual.TestClasses[0].TestClassName); Assert.AreEqual(TimeSpan.FromSeconds(0.3), actual.TestClasses[0].Duration); Assert.AreEqual(2, actual.TestClasses[0].TestMethods.Count); Assert.AreEqual(TestResult.Failed, actual.TestClasses[0].Result); foreach (var method in actual.TestClasses[0].TestMethods) { if (method.TestMethodName == "Test") { Assert.AreEqual(TestResult.Success, method.Result); Assert.AreEqual(TimeSpan.FromSeconds(0.1), method.Duration); } else if (method.TestMethodName == "Test2") { Assert.AreEqual(TestResult.Failed, method.Result); Assert.AreEqual(TimeSpan.FromSeconds(0.2), method.Duration); } else { Assert.Fail(); } } }
public void TransformsTestResultCorrectly() { var testEvent = new TestRunEvent { Tests = { new TestCaseResult { TestMethod = TestMethod1 } } }; var sut = new TestRunIntervalTransformer(_context); sut.ProcessEvent(testEvent); var actual = sut.SignalEndOfEventStream().First(); Assert.AreEqual("TestProj1", actual.ProjectName); Assert.AreEqual(1, actual.TestClasses.Count); Assert.AreEqual("Test.TestClass", actual.TestClasses[0].TestClassName); Assert.AreEqual(1, actual.TestClasses[0].TestMethods.Count); Assert.AreEqual("Test", actual.TestClasses[0].TestMethods[0].TestMethodName); }
public void SplitsUpEventsWithMultipleProjects() { var testEvent = new TestRunEvent { Tests = { new TestCaseResult { TestMethod = TestMethod1 }, new TestCaseResult { TestMethod = TestMethodInOtherProject } } }; var sut = new TestRunIntervalTransformer(_context); sut.ProcessEvent(testEvent); var actual = sut.SignalEndOfEventStream(); Assert.AreEqual(2, actual.Count()); }