public void GivenAttribute_SetsCorrectDescriptionAsDisplayName() { string description = "A sample attribute description."; GivenAttribute sut = new GivenAttribute(description, 1); sut.DisplayName.Should().Be($"Given {description}"); }
public void GivenAttribute_AllowsToSpecifyOrder() { int expectedOrder = 1; GivenAttribute sut = new GivenAttribute("test", expectedOrder); sut.Order.Should().Be(expectedOrder); }
public void Should_pick_uppercase_word_as_parameter_if_multiple_words_match_parameter_name() { var a = new GivenAttribute(); MethodInfo method = GetType().GetMethod("Given_multiple_choices_to_match_the_parameter_parameter_PARAMETER_parameter"); a.BuildActionMatchFromMethodInfo(method); Assert.AreEqual(@"^multiple\s+choices\s+to\s+match\s+the\s+parameter\s+parameter\s+(?<parameter>.+)\s+parameter\s*$", a.ActionMatch.ToString()); }
public void Should_handle_method_names_with_spaces_and_parameter_in_name() { var a = new GivenAttribute(); var method = typeof(TestLib.ConfigFileActionSteps).GetMethod("the value of setting $key is read"); a.BuildActionMatchFromMethodInfo(method, a); Assert.AreEqual(@"^the\s+value\s+of\s+setting\s+(?<key>.+)\s+is\s+read\s*$", a.ActionMatch.ToString()); }
public void Should_handle_method_names_with_spaces_as_regex() { var a = new GivenAttribute(); var method = typeof(TestLib.ConfigFileActionSteps).GetMethod("an assembly with a matching configuration file"); a.BuildActionMatchFromMethodInfo(method, a); Assert.AreEqual(@"^an\s+assembly\s+with\s+a\s+matching\s+configuration\s+file\s*$", a.ActionMatch.ToString()); }
public void Should_pick_uppercase_word_as_parameter_if_multiple_words_match_parameter_name() { var a = new GivenAttribute(); MethodInfo method = GetType().GetMethod("Given_multiple_choices_to_match_the_parameter_parameter_PARAMETER_parameter"); a.BuildActionMatchFromMethodInfo(method, a); Assert.AreEqual(@"^multiple\s+choices\s+to\s+match\s+the\s+parameter\s+parameter\s+(?<parameter>.+)\s+parameter\s*$", a.ActionMatch.ToString()); }
public void WorksWithMultipleQuotedAndNonQuotedStringIsAnExtremelyComplexSetUpThatReallyShouldNeverHappen() { var step = Step.Given(@"i am punching ""hello there, my name is Joe!""" + @" into Word2, which actually was better than" + @" WordPerfect - mostly because of ""WYSIWYG"", though"); var attr = new GivenAttribute(@"i am punching ""$g""" + @" into $app, which actually was better than" + @" $app2 - mostly because of ""$why"", though"); var method = new ActionStepMethod(null, attr); var match = matcher.GetMatch(step, method); Assert.IsTrue(match.IsMatch); AssertVar(match.Tokens[3], "g", "hello there, my name is Joe!"); AssertVar(match.Tokens[5], "app", "Word2"); AssertVar(match.Tokens[11], "app2", "WordPerfect"); AssertVar(match.Tokens[16], "why", "WYSIWYG"); }
public void ShouldIgnoreSpaceAtEndOfStep() { var g = new GivenAttribute("something"); Assert.That(g.ActionMatch.IsMatch("something "), Is.True); }
public void GivenAttribute_SkipDescriptionIsAlwaysEmpty() { GivenAttribute sut = new GivenAttribute("test", 1); sut.Skip.Should().BeEmpty(); }
public void ShouldIgnoreSpaceAtEndOfStep() { var g = new GivenAttribute("something"); Assert.That(g.ActionMatch.IsMatch("something "), Is.True); }