public void AddMethodToDynamicCallGraph_CorrectState() { var testName = "MyTest"; var target = new TestStateRecorder(mockMethodDumper); target.StartTest(testName); Assert.IsNotNull(target.CurrentTest); Assert.AreEqual(testName, target.CurrentTest.Name); target.AddMethodToDynamicCallGraph("Bar"); target.AddMethodToDynamicCallGraph("Baz"); target.AddMethodToDynamicCallGraph("Biff"); target.RecordVoidInstanceMethodCall("Hello World", "Foo"); // Assert counter stats AssertRecorderListAndCounterStates( expectedMethodCounter: 1U, expectedTestCounter: 0U, numberOfTestExecutions: 0, target: target); // Should have three calls. Assert.AreEqual(3, target.CurrentMethodCall.DynamicCallGraph.Count); AssertSequencesAreCorrect(target); target.EndTest(); AssertRecorderListAndCounterStates( expectedMethodCounter: 0U, expectedTestCounter: 1U, numberOfTestExecutions: 1, target: target); }
public void EndToEndTest_PassTestBoundary_CorrectState() { var testName1 = "MyTest1"; var testName2 = "MyTest2"; var testClass = new TestClass(); var target = new TestStateRecorder(mockMethodDumper); target.StartTest(testName1); Assert.IsNotNull(target.CurrentTest); Assert.AreEqual(testName1, target.CurrentTest.Name); target.RecordVoidInstanceMethodCall(testClass, "Foo"); target.AddMethodToDynamicCallGraph("Baz"); target.AddMethodToDynamicCallGraph("Biff"); target.RecordInstanceMethodCall(testClass, 5, "Bar"); target.AddMethodToDynamicCallGraph("Zoo"); target.EndTest(); // Test counter state. AssertRecorderListAndCounterStates( expectedMethodCounter: 0U, expectedTestCounter: 1U, numberOfTestExecutions: 1, target: target); // Do it all again. target.StartTest(testName2); Assert.IsNotNull(target.CurrentTest); Assert.AreEqual(testName2, target.CurrentTest.Name); target.AddMethodToDynamicCallGraph("Baz"); target.RecordVoidInstanceMethodCall(testClass, "Foo"); target.AddMethodToDynamicCallGraph("Zoo"); target.AddMethodToDynamicCallGraph("Boo"); target.RecordInstanceMethodCall(testClass, 5, "Bar"); target.EndTest(); // Test counter state AssertRecorderListAndCounterStates( expectedMethodCounter: 0U, expectedTestCounter: 2U, numberOfTestExecutions: 2, target: target); AssertSequencesAreCorrect(target); }