dimanche 3 avril 2016

Is it possible to unit test ValidationFeature plugin in ServiceStack

I would like to unit test my ValidationFeature rulesets in my ServiceStack project however the plugin is not being initialized when creating my appHost object.

Here is my original code to initialize the appHost.

    [TestFixtureSetUp]
    private void TestFixtureSetUp()
    {
        appHost = new BasicAppHost().Init();
        appHost.Plugins.Add(new ValidationFeature());
        var container = appHost.Container;
        container.RegisterValidators(typeof(ApplicationValidator).Assembly);
        container.RegisterAutoWiredAs<FakeRetailReferralRepository, IRetailReferralRepository>();
        container.RegisterAutoWired<SubmitApplicationService>();            
    }

I've tried moving the Plugins.Add line inbetween the BasicAppHost contructor and Init() and that didn't work either. Is what I'm trying to do possible?

Aucun commentaire:

Enregistrer un commentaire