mardi 19 avril 2016

Nunit test gives result OneTimeSetUp: No suitable constructor was found

I have an issue where NUnit is telling me: "No suitable constructor was found". What causes this? I also get another message: "Exception doesn't have a stacktrace". Both messages just repeat over and over again. Here's my code

[TestFixture]
public class SecurityServiceTests
{
    private IContext stubIContext;
    private ISecurityService securityService;
    private IWindsorContainer windsorContainer;

    public SecurityServiceTests(IContext stubIContext)
    {
        this.stubIContext= stubIContext;
    }

    [TestFixtureSetUp]
    public void TestSetup()
    {
        //Mocks the database context
        stubIContext= MockRepository.GenerateStub<IContext>();
        var returnedList = new List<string>();
        stubIContext.Stub(a => a.GetUserSecurities(null)).IgnoreArguments().Return(returnedList);

        securityService = new SecurityService(windsorContainer);

    }

    [Test]
    public void ControllerShouldGetUserGroupForCurrentUsers()
    {
        //Act
        var action = securityService.CurrentUserFeatureList;

        //Assert
        Assert.IsNotNull(action);
    }


}

Aucun commentaire:

Enregistrer un commentaire