コード例 #1
0
        public void Given_a_new_PrettyFactAttribute_When_testMethodName_is_blank_Then_an_ArgumentException_is_thrown(string testMethodName)
        {
            // Given.
            PrettyFactAttribute attribute;

            // When.
            Action testCode = () => attribute = new PrettyFactAttribute(testMethodName);

            // Then.
            testCode.Should().Throw <ArgumentException>().WithMessage("Cannot be blank*testMethodName");
        }
コード例 #2
0
        public void Given_a_new_PrettyFactAttribute_When_testMethodName_is_null_Then_an_ArgumentNullException_is_thrown()
        {
            // Given.
            PrettyFactAttribute attribute;

            // When.
            Action testCode = () => attribute = new PrettyFactAttribute(null);

            // Then.
            testCode.Should().Throw <ArgumentNullException>();
        }
コード例 #3
0
        public void Given_a_new_PrettyFactAttribute_When_testMethodName_contains_underscores_Then_DisplayName_will_have_underscores_replaced_with_spaces()
        {
            // Given.
            PrettyFactAttribute attribute;
            string testMethodName;

            // When.
            testMethodName = "Given_X_When_Y_Then_Z";
            attribute      = new PrettyFactAttribute(testMethodName);

            // Then.
            attribute.DisplayName.Should().BeEquivalentTo("Given X When Y Then Z");
        }
コード例 #4
0
        public void Given_a_new_PrettyFactAttribute_When_testMethodName_contains_no_underscores_Then_DisplayName_will_be_the_same_as_testMethodName()
        {
            // Given.
            PrettyFactAttribute attribute;
            string testMethodName;

            // When.
            testMethodName = "GivenXWhenYThenZ";
            attribute      = new PrettyFactAttribute(testMethodName);

            // Then.
            attribute.DisplayName.Should().BeEquivalentTo(testMethodName);
        }