public void Test() { var testObject = new TestClassWithStepsReturningTheirText(1, "some input"); var steps = new DefaultMethodNameStepScanner().Scan(testObject).ToList(); AssertStep(steps[0], "Given inputs 1 and some input", ExecutionOrder.SetupState); AssertStep(steps[1], "When input 2 is applied on 123", ExecutionOrder.Transition); AssertStep(steps[2], "Then some assertions", ExecutionOrder.Assertion, true); }
static void VerifyMethod(string expectedStepTitle, bool exists = true) { var testObject = new ScenarioWithVaryingStepTexts(); var scanner = new DefaultMethodNameStepScanner(); var steps = scanner.Scan(testObject).ToList(); var theStep = steps.Where(s => s.StepTitle == expectedStepTitle); if(exists) Assert.That(theStep.Count(), Is.EqualTo(1)); else Assert.That(theStep.Count(), Is.EqualTo(0)); }