public ResourceDefinitionReadTests(ExampleIntegrationTestContext <TestableStartup <UniverseDbContext>, UniverseDbContext> testContext) { _testContext = testContext; testContext.UseController <StarsController>(); testContext.UseController <PlanetsController>(); testContext.UseController <MoonsController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddResourceDefinition <StarDefinition>(); services.AddResourceDefinition <PlanetDefinition>(); services.AddResourceDefinition <MoonDefinition>(); services.AddSingleton <IClientSettingsProvider, TestClientSettingsProvider>(); services.AddSingleton <ResourceDefinitionHitCounter>(); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = true; var settingsProvider = (TestClientSettingsProvider)testContext.Factory.Services.GetRequiredService <IClientSettingsProvider>(); settingsProvider.ResetToDefaults(); var hitCounter = _testContext.Factory.Services.GetRequiredService <ResourceDefinitionHitCounter>(); hitCounter.Reset(); }
public AtomicCreateResourceWithToOneRelationshipTests( ExampleIntegrationTestContext <TestableStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => services.AddControllersFromExampleProject()); }
public ExceptionHandlerTests(ExampleIntegrationTestContext <TestableStartup <ErrorDbContext>, ErrorDbContext> testContext) { _testContext = testContext; testContext.UseController <ThrowingArticlesController>(); testContext.UseController <ConsumerArticlesController>(); FakeLoggerFactory loggerFactory = null; testContext.ConfigureLogging(options => { loggerFactory = new FakeLoggerFactory(); options.ClearProviders(); options.AddProvider(loggerFactory); options.SetMinimumLevel(LogLevel.Warning); }); testContext.ConfigureServicesBeforeStartup(services => { if (loggerFactory != null) { services.AddSingleton(_ => loggerFactory); } }); testContext.ConfigureServicesAfterStartup(services => { services.AddResourceService <ConsumerArticleService>(); services.AddScoped <IExceptionHandler, AlternateExceptionHandler>(); }); }
public ResourceHookTests(ExampleIntegrationTestContext <ResourceHooksStartup <HooksDbContext>, HooksDbContext> testContext) { _testContext = testContext; testContext.UseController <ArticlesController>(); testContext.UseController <AuthorsController>(); testContext.UseController <PassportsController>(); testContext.UseController <PeopleController>(); testContext.UseController <TodoItemsController>(); testContext.UseController <UsersController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddScoped <ResourceHooksDefinition <Article>, ArticleHooksDefinition>(); services.AddScoped <ResourceHooksDefinition <Passport>, PassportHooksDefinition>(); services.AddScoped <ResourceHooksDefinition <Person>, PersonHooksDefinition>(); services.AddScoped <ResourceHooksDefinition <Tag>, TagHooksDefinition>(); services.AddScoped <ResourceHooksDefinition <TodoItem>, TodoItemHooksDefinition>(); services.AddScoped(typeof(IResourceChangeTracker <>), typeof(NeverSameResourceChangeTracker <>)); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.DisableTopPagination = false; options.DisableChildrenPagination = false; }
public EagerLoadingTests(ExampleIntegrationTestContext <TestableStartup <EagerLoadingDbContext>, EagerLoadingDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddResourceRepository <BuildingRepository>(); }); }
public ResourceMetaTests(ExampleIntegrationTestContext <TestableStartup <SupportDbContext>, SupportDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped <IResourceDefinition <SupportTicket>, SupportTicketDefinition>(); }); }
public SoftDeletionTests(ExampleIntegrationTestContext <TestableStartup <SoftDeletionDbContext>, SoftDeletionDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped <IResourceDefinition <Company>, SoftDeletionResourceDefinition <Company> >(); services.AddScoped <IResourceDefinition <Department>, SoftDeletionResourceDefinition <Department> >(); }); }
public DisableQueryStringTests(ExampleIntegrationTestContext <TestableStartup <RestrictionDbContext>, RestrictionDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped <SkipCacheQueryStringParameterReader>(); services.AddScoped <IQueryStringParameterReader>(sp => sp.GetRequiredService <SkipCacheQueryStringParameterReader>()); }); }
public AtomicCreateResourceWithClientGeneratedIdTests(ExampleIntegrationTestContext <TestableStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => services.AddControllersFromExampleProject()); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.AllowClientGeneratedIds = true; }
public WorkflowTests(ExampleIntegrationTestContext <ModelStateValidationStartup <WorkflowDbContext>, WorkflowDbContext> testContext) { _testContext = testContext; testContext.UseController <WorkflowsController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddResourceDefinition <WorkflowDefinition>(); }); }
public AtomicAbsoluteLinksTests(ExampleIntegrationTestContext <TestableStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddControllersFromExampleProject(); services.AddScoped(typeof(IResourceChangeTracker <>), typeof(NeverSameResourceChangeTracker <>)); }); }
public AtomicResponseMetaTests(ExampleIntegrationTestContext <TestableStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddControllersFromExampleProject(); services.AddSingleton <IResponseMeta, AtomicResponseMeta>(); }); }
public AtomicResourceMetaTests(ExampleIntegrationTestContext <TestableStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddControllersFromExampleProject(); services.AddScoped <IResourceDefinition <MusicTrack, Guid>, MusicTrackMetaDefinition>(); services.AddScoped <IResourceDefinition <TextLanguage, Guid>, TextLanguageMetaDefinition>(); }); }
public AtomicResourceMetaTests(ExampleIntegrationTestContext <TestableStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.UseController <OperationsController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddResourceDefinition <MusicTrackMetaDefinition>(); services.AddResourceDefinition <TextLanguageMetaDefinition>(); }); }
public CompositeKeyTests(ExampleIntegrationTestContext<TestableStartup<CompositeDbContext>, CompositeDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddResourceRepository<CarRepository>(); }); var options = (JsonApiOptions) testContext.Factory.Services.GetRequiredService<IJsonApiOptions>(); options.AllowClientGeneratedIds = true; }
public ResourceMetaTests(ExampleIntegrationTestContext <TestableStartup <SupportDbContext>, SupportDbContext> testContext) { _testContext = testContext; testContext.UseController <ProductFamiliesController>(); testContext.UseController <SupportTicketsController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddResourceDefinition <SupportTicketDefinition>(); }); }
public AtomicRelativeLinksWithNamespaceTests( ExampleIntegrationTestContext <RelativeLinksInApiNamespaceStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.UseController <OperationsController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddScoped(typeof(IResourceChangeTracker <>), typeof(NeverSameResourceChangeTracker <>)); }); }
public OutboxTests(ExampleIntegrationTestContext <TestableStartup <OutboxDbContext>, OutboxDbContext> testContext) { _testContext = testContext; testContext.UseController <DomainUsersController>(); testContext.UseController <DomainGroupsController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddResourceDefinition <OutboxUserDefinition>(); services.AddResourceDefinition <OutboxGroupDefinition>(); }); }
public AbsoluteLinksWithNamespaceTests(ExampleIntegrationTestContext <AbsoluteLinksInApiNamespaceStartup <LinksDbContext>, LinksDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped(typeof(IResourceChangeTracker <>), typeof(NeverSameResourceChangeTracker <>)); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = true; }
public ResponseMetaTests(ExampleIntegrationTestContext <TestableStartup <SupportDbContext>, SupportDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddSingleton <IResponseMeta, SupportResponseMeta>(); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = false; }
public SparseFieldSetTests(ExampleIntegrationTestContext <TestableStartup <QueryStringDbContext>, QueryStringDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddSingleton <ResourceCaptureStore>(); services.AddResourceRepository <ResultCapturingRepository <Blog> >(); services.AddResourceRepository <ResultCapturingRepository <BlogPost> >(); services.AddResourceRepository <ResultCapturingRepository <WebAccount> >(); }); }
public AtomicSparseFieldSetResourceDefinitionTests(ExampleIntegrationTestContext <TestableStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddControllersFromExampleProject(); services.AddSingleton <LyricPermissionProvider>(); services.AddScoped <IResourceDefinition <Lyric, long>, LyricTextDefinition>(); services.AddScoped(typeof(IResourceChangeTracker <>), typeof(NeverSameResourceChangeTracker <>)); }); }
public TopLevelCountTests(ExampleIntegrationTestContext <TestableStartup <SupportDbContext>, SupportDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped(typeof(IResourceChangeTracker <>), typeof(NeverSameResourceChangeTracker <>)); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = true; }
public ArchiveTests(ExampleIntegrationTestContext <TestableStartup <TelevisionDbContext>, TelevisionDbContext> testContext) { _testContext = testContext; testContext.UseController <TelevisionNetworksController>(); testContext.UseController <TelevisionStationsController>(); testContext.UseController <TelevisionBroadcastsController>(); testContext.UseController <BroadcastCommentsController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddResourceDefinition <TelevisionBroadcastDefinition>(); }); }
public SerializationTests(ExampleIntegrationTestContext <TestableStartup <SerializationDbContext>, SerializationDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped(typeof(IResourceChangeTracker <>), typeof(NeverSameResourceChangeTracker <>)); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeExceptionStackTraceInErrors = false; options.AllowClientGeneratedIds = true; }
public ResourceDefinitionQueryCallbackTests(ExampleIntegrationTestContext <TestableStartup <CallableDbContext>, CallableDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped <IResourceDefinition <CallableResource>, CallableResourceDefinition>(); services.AddSingleton <IUserRolesService, FakeUserRolesService>(); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = true; }
public AtomicAbsoluteLinksTests(ExampleIntegrationTestContext <TestableStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.UseController <OperationsController>(); // These routes need to be registered in ASP.NET for rendering links to resource/relationship endpoints. testContext.UseController <TextLanguagesController>(); testContext.UseController <RecordCompaniesController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddScoped(typeof(IResourceChangeTracker <>), typeof(NeverSameResourceChangeTracker <>)); }); }
public RelativeLinksWithoutNamespaceTests(ExampleIntegrationTestContext <RelativeLinksNoNamespaceStartup <LinksDbContext>, LinksDbContext> testContext) { _testContext = testContext; testContext.UseController <PhotoAlbumsController>(); testContext.UseController <PhotosController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddScoped(typeof(IResourceChangeTracker <>), typeof(NeverSameResourceChangeTracker <>)); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = true; }
public ResourceMetaTests(ExampleIntegrationTestContext <TestableStartup <SupportDbContext>, SupportDbContext> testContext) { _testContext = testContext; testContext.UseController <ProductFamiliesController>(); testContext.UseController <SupportTicketsController>(); testContext.ConfigureServicesAfterStartup(services => { services.AddResourceDefinition <SupportTicketDefinition>(); services.AddSingleton <ResourceDefinitionHitCounter>(); }); var hitCounter = _testContext.Factory.Services.GetRequiredService <ResourceDefinitionHitCounter>(); hitCounter.Reset(); }
public AtomicTransactionConsistencyTests(ExampleIntegrationTestContext <TestableStartup <OperationsDbContext>, OperationsDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddControllersFromExampleProject(); services.AddResourceRepository <PerformerRepository>(); services.AddResourceRepository <MusicTrackRepository>(); services.AddResourceRepository <LyricRepository>(); string postgresPassword = Environment.GetEnvironmentVariable("PGPASSWORD") ?? "postgres"; string dbConnectionString = $"Host=localhost;Port=5432;Database=JsonApiTest-{Guid.NewGuid():N};User ID=postgres;Password={postgresPassword}"; services.AddDbContext <ExtraDbContext>(options => options.UseNpgsql(dbConnectionString)); }); }