Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@plioi
Copy link
Contributor

@plioi plioi commented Feb 24, 2015

When using the TestDriven.NET runner against a target namespace, test classes including nested test classes in the namespace are executed. This pull request implements similar behavior when running the TestDriven.NET runner against a target class.

@TheCloudlessSky identified the bug using the following sample class:

class CalculatorTests
{
    class Adding
    {
        public void computes_the_sum()
        {
            var sut = new Calculator();

            var result = sut.Add(1, 2);

            result.ShouldEqual(3);
        }
    }

    class Subtracting
    {
        public void computes_the_difference()
        {
            var sut = new Calculator();

            var result = sut.Subtract(3, 2);

            result.ShouldEqual(1);
        }
    }
}

This pull request ensures that when invoking TestDriven.NET on CalculatorTests, the inner types Adding and Subtracting are also considered by the applicable conventions, instead of only considering CalculatorTests. Doing so brings Fixie's TestDriven.NET in line with the same behavior in the xUnit TestDriven.NET runner. (Naturally, if the conventions don't consider the nested types to be test classes, they'll be rightly skipped over like any other non-test class.)

…ternal, to make room for a new public method with that signature.
…test class types against all applicable conventions.
…Type, all tests in that Type and its nested Types will be discovered and run, analogous to the existing behavior when the TestDriven.NET runner is instructed to run tests in a given namespace.
plioi added a commit that referenced this pull request Feb 24, 2015
TestDriven.NET runner includes tests from nested classes when the user targets a type.
@plioi plioi merged commit 9bf1f32 into master Feb 24, 2015
@plioi plioi deleted the testdrivendotnet-run-nested-types branch February 24, 2015 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants