public SpecFlowTestHooks(
            EntityFrameworkContext entityFrameworkContext, 
            TestContext testContext,
            FixtureContext fixtureContext,
            TestGetCurrentUserQuery testGetCurrentUserQuery)
        {
            this.entityFrameworkContext = entityFrameworkContext;
            this.testContext = testContext;

            fixtureContext.Fixture.Customize(new AutoConfiguredNSubstituteCustomization());
            fixtureContext.Fixture.Customize(new ApiControllerCustomisation());
            HttpContext.Current = HttpContextFaker.FakeHttpContext();

            fixtureContext.Fixture.Register<IDataContext>(() => entityFrameworkContext.DataContext);
            fixtureContext.Fixture.Register<IGetCurrentUserQuery>(() => testGetCurrentUserQuery);

            fixtureContext.Fixture.RegisterForAssembly(typeof(IAddEntityCommand).Assembly, "FinalYearProjectBlog.CommandQuery.Commands");
            fixtureContext.Fixture.RegisterForAssembly(typeof(IGetAllEntityQuery).Assembly, "FinalYearProjectBlog.CommandQuery.Queries");
            fixtureContext.Fixture.RegisterForAssembly(typeof(IBlogPostMapper).Assembly, "FinalYearProjectBlog.Model.Mappers");
            fixtureContext.Fixture.RegisterForAssembly(typeof(IBlogPostControllerValidator).Assembly, "FinalYearProjectBlog.Web.Controllers.Api.Validators");
            fixtureContext.Fixture.RegisterForAssembly(typeof(IEmailSenderService).Assembly, "FinalYearProjectBlog.CommandQuery.Services");
            fixtureContext.Fixture.RegisterForAssembly(typeof(IBlogPostViewModelBuilder).Assembly, "FinalYearProjectBlog.Web.View.Builders");

            fixtureContext.Fixture.Register<ISimpleInjectorConfig>(() => new TestSimpleInjectorConfig(fixtureContext.SpecimenContext));
        }
Пример #2
0
 public UserSteps(TestGetCurrentUserQuery testGetCurrentUserQuery, 
     EntityFrameworkContext entityFrameworkContext, 
     TestUserController userController)
 {
     this.testGetCurrentUserQuery = testGetCurrentUserQuery;
     this.entityFrameworkContext = entityFrameworkContext;
     this.userController = userController;
 }