public async Task WhenGetAccountSettingsCalledAndNoProfileImageExists_ItShouldGetAccountSettingsFromTheDatabase() { await this.DatabaseTestAsync(async testDatabase => { this.target = new GetAccountSettingsDbStatement(testDatabase); await this.CreateDataAsync( testDatabase, UserId, Username, Email, null, 0, false, false, false); await testDatabase.TakeSnapshotAsync(); var result = await this.target.ExecuteAsync(UserId, FreePostsTimestamp2, MaximumFreePosts); var expectedResult = new GetAccountSettingsDbResult( Username, Email, null, 0, PaymentStatus.None, false, null, ExpectedFreePostRemaining); Assert.AreEqual(expectedResult, result); return(ExpectedSideEffects.None); }); }
public async Task WhenGetAccountSettingsCalledWithInvalidUserId_ItShouldThrowARecoverableException() { await this.DatabaseTestAsync(async testDatabase => { this.target = new GetAccountSettingsDbStatement(testDatabase); await this.CreateDataAsync( testDatabase, UserId, Username, Email, FileId, 0, false, false, false); await testDatabase.TakeSnapshotAsync(); Func <Task> badMethodCall = () => this.target.ExecuteAsync(new UserId(Guid.NewGuid()), FreePostsTimestamp2, MaximumFreePosts); await badMethodCall.AssertExceptionAsync <DetailedRecoverableException>(); return(ExpectedSideEffects.None); }); }
private void InitializeServices(TestDatabaseContext testDatabase) { this.updateAccountBalances = new UpdateAccountBalancesDbStatement(testDatabase); this.getAccountSettings = new GetAccountSettingsDbStatement(testDatabase); this.getCreatorRevenue = new GetCreatorRevenueDbStatement(testDatabase); this.persistCreditRefund = new PersistCreditRefund( new GuidCreator(), new PersistCommittedRecordsDbStatement(testDatabase)); this.createTransactionRefund = new CreateTransactionRefund( new GuidCreator(), new GetRecordsForTransactionDbStatement(testDatabase), new PersistCommittedRecordsDbStatement(testDatabase)); this.getCreditTransactionInformation = new GetCreditTransactionInformation( new GetRecordsForTransactionDbStatement(testDatabase)); this.getCalculatedAccountBalances = new GetCalculatedAccountBalancesDbStatement(testDatabase); }
public void Initialize() { // Required for non-database tests. this.target = new GetAccountSettingsDbStatement(new Mock <IFifthweekDbConnectionFactory>(MockBehavior.Strict).Object); }