public void Accept_ShouldBeVisited() { // Arrange var visitor = Mock.Of <ITestStepVisitor>(); // Act executeMethodStep.Accept(visitor); // Assert Mock.Get(visitor) .Verify(v => v.Visit(executeMethodStep), Times.Once); }
public void ShouldFormatMethodName() { // Arrange var executeMethodStep = new ExecuteMethodStep(); executeMethodStep.MethodName = "Method With Spaces"; executeMethodStep.Accept(visitor); // Act var result = visitor.Build(); // Assert result.ShouldNotContain("Method With Spaces"); result.ShouldContain("Method_With_Spaces"); }
public void ShouldFormatParameterName() { // Arrange var executeMethodStep = new ExecuteMethodStep(); executeMethodStep.MethodName = "Method1"; executeMethodStep.Parameters.Add(new MethodParameter("parameter with spaces", "value")); executeMethodStep.Accept(visitor); // Act var result = visitor.Build(); // Assert result.ShouldNotContain("parameter with spaces"); result.ShouldContain("parameter_with_spaces"); }
public void ShouldCreateMethodWithMultipleParameters() { // Arrange var executeMethodStep = new ExecuteMethodStep(); executeMethodStep.MethodName = "Method1"; executeMethodStep.Parameters.Add(new MethodParameter("age", "32")); executeMethodStep.Parameters.Add(new MethodParameter("name", "rodrigo")); executeMethodStep.Parameters.Add(new MethodParameter("age", "33")); executeMethodStep.Accept(visitor); // Act var result = visitor.Build(); // Assert result.ShouldContain(@"this.Method1(""32"", ""rodrigo"", ""33"");"); result.ShouldContain("public void Method1(string age, string name, string age)"); }