Beispiel #1
0
        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);
        }
Beispiel #2
0
        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");
        }
Beispiel #3
0
        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");
        }
Beispiel #4
0
        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)");
        }