3

I am using Mspec with FakeItEasy and I keep getting inconclusive test results. I tried commenting out my fake setup code and even the actual invocation of the method under test. I'm also unable to debug the test. I also just tried a simple test like this:

private Then it_should_be_true = () => true.ShouldBeTrue();

What is the cause of inconclusive tests?

enter image description here

[Tags("IntegrationTest")]
[Subject(typeof(AuthManager))]
public class When_a_login_is_performed_using_valid_credentials
{
    protected static string MemberUsername;
    protected static string MemberPassword;
    protected static SignInResponse Response;

    private Given context = () =>
    {
        MemberUsername = "User1";
        MemberPassword = "Pass1";
    };

    private When test = () =>
    {
        Response = AuthManager.Current.SignIn(MemberUsername, MemberPassword);
    };

    private Then It_should_return_a_successful_response = () => Response.Success.ShouldBeTrue();
    private Then It_should_not_contain_any_reported_errors = () => Response.Errors.ShouldBeEmpty();
    private Then It_should_have_an_Id_populated = () => Response.Id.ShouldNotBeEmpty();
}

I wrapped It to become Then to match BDD syntax using the below code. It has always worked in the past.

using Machine.Specifications;

namespace Testing.MachineSpecifications
{
    /// <summary>
    /// Given
    /// </summary>
    [SetupDelegate]
    public delegate void Given();

    /// <summary>
    /// When
    /// </summary>
    [ActDelegate]
    public delegate void When();

    /// <summary>
    /// Then
    /// </summary>
    [AssertDelegate]
    public delegate void Then();
}
Adam
  • 4,590
  • 10
  • 51
  • 84
  • I'm not a Machine.Specifications expert, so I'll approach this from another direction first. In what way does this use FakeItEasy? If you remove FakeItEasy from the project altogether does anything change? Have you been able to run Machine.Specifications tests in the past? – Blair Conrad May 13 '15 at 14:58
  • Yes I have other Mspec tests in other libraries that have run successfully. Just mentioned FakeItEasy for completeness. Just wondering if there is a common scenario that causes these kind of test results? – Adam May 13 '15 at 15:02
  • Ah, I don't have light to shed, unfortunately. FakeItEasy actually uses Machine.Specifications for its acceptance tests, so the two are not completely incompatible. Sorry. – Blair Conrad May 13 '15 at 19:10
  • Can you provide the entire class? I am suspicious that something might be wrong with this class's visibility. – Anthony Mastrean May 14 '15 at 15:07
  • 1
    Also, can you comment on the test runner you're using... seems to be some trouble with ReSharper in the past. https://github.com/machine/machine.specifications.runner.resharper/issues?utf8=%E2%9C%93&q=is%3Aissue+inconclusive – Anthony Mastrean May 14 '15 at 15:08
  • 2
    Post the whole class that contains your assertion. Also, I'm not sure where `Then` comes from, MSpec uses `It`. – Andy May 14 '15 at 15:16
  • I am using the latest MSpec runner extension installed through the Resharper Extension Manager https://github.com/machine/machine.specifications.runner.resharper and I wrapped `Because` and `It` in `When` and `Then` to match BDD style syntax. I have used that successfully in the past without issues. – Adam Aug 14 '15 at 13:03
  • I also tried just using the normal `Establish/Because/It` delegates instead of my wrappers and that also didn't help. – Adam Aug 14 '15 at 13:18

1 Answers1

2

The machine.specifications.runner.resharper runner was one version behind ReSharper. In the future, it would be good to wait on upgrading ReSharper until the runner has time to catch up with compatibility.

Adam
  • 4,590
  • 10
  • 51
  • 84