예제 #1
0
            public void Should_handle_spaces_in_docstring_in_ToString()
            {
                var step = new StringStep("Given step with docstring", "source");
                step.AddDocString("  hello");

                Assert.AreEqual("Given step with docstring" + Environment.NewLine +
                    "  \"\"\"" + Environment.NewLine +
                    "  hello" + Environment.NewLine +
                    "  \"\"\"" + Environment.NewLine, step.ToString());
            }
예제 #2
0
            public void Should_handle_spaces_in_docstring_in_ToString()
            {
                var step = new StringStep("Given", "step with docstring", "source");

                step.AddDocString("  hello");

                Assert.AreEqual("Given step with docstring" + Environment.NewLine +
                                "  \"\"\"" + Environment.NewLine +
                                "  hello" + Environment.NewLine +
                                "  \"\"\"" + Environment.NewLine, step.ToString());
            }
            public void ShouldInvokeActionGivenATokenString()
            {
                var wasCalled = false;
                var docString = "";
                Action <int, string> action = (value, thisIsThedocString) =>
                {
                    wasCalled = true;
                    docString = thisIsThedocString;
                };

                actionCatalog.Add(new ActionMethodInfo("a value $value followed by docstring".AsRegex(), action, action.Method, "Given"));
                var stringStep = new StringStep("Given a value 42 followed by docstring", "");

                stringStep.AddDocString("docString");
                runner.Run(stringStep);
                Assert.IsTrue(wasCalled, "Action was not called");
                Assert.AreEqual("docString", docString);
            }
예제 #4
0
 public void ShouldInvokeActionGivenATokenString()
 {
     var wasCalled = false;
     var docString = "";
     Action<int, string> action = (value, thisIsThedocString) =>
     {
         wasCalled = true;
         docString = thisIsThedocString;
     };
     actionCatalog.Add(new ActionMethodInfo("a value $value followed by docstring".AsRegex(), action, action.Method, "Given"));
     var stringStep = new StringStep("Given a value 42 followed by docstring", "");
     stringStep.AddDocString("docString");
     runner.Run(stringStep);
     Assert.IsTrue(wasCalled, "Action was not called");
     Assert.AreEqual("docString", docString);
 }