public void TestInitialize() { Initialize(mockedServices: false); ApiKeyAuthentication = AppSettings.RestAdminAPIKey; FeeQuoteRepository = server.Services.GetRequiredService <IFeeQuoteRepository>() as FeeQuoteRepositoryPostgres; FeeQuoteRepositoryMock.quoteExpiryMinutes = 10; }
private static async Task CheckCreateDbAndClearDbAsync(IStartupChecker startup, string dbConnectionString) { await startup.CheckAsync(true); // delete database before each test NodeRepositoryPostgres.EmptyRepository(dbConnectionString); TxRepositoryPostgres.EmptyRepository(dbConnectionString); FeeQuoteRepositoryPostgres.EmptyRepository(dbConnectionString); }
protected void SetPoliciesForCurrentFeeQuote(string policiesJsonString, UserAndIssuer userAndIssuer = null) { var feeQuote = FeeQuoteRepository.GetCurrentFeeQuoteByIdentity(userAndIssuer); FeeQuoteRepositoryPostgres.EmptyRepository(DbConnectionStringDDL); feeQuote.Policies = policiesJsonString; using (MockedClock.NowIs(DateTime.UtcNow.AddMinutes(-1))) { if (FeeQuoteRepository.InsertFeeQuoteAsync(feeQuote).Result == null) { throw new Exception("Can not insert test fee quote with policies."); } } }
protected override void CleanRepositories(string dbConnectionString) { NodeRepositoryPostgres.EmptyRepository(DBConnectionStringDDL ?? dbConnectionString); TxRepositoryPostgres.EmptyRepository(DBConnectionStringDDL ?? dbConnectionString); FeeQuoteRepositoryPostgres.EmptyRepository(DBConnectionStringDDL ?? dbConnectionString); }