public async Task AccountInfo_Successes(int accountId, double ammount) { var testee = new AccountInfoAsync(accountId, moq.Object); await testee.RefreshAmountAsync(); Assert.Equal(ammount, testee.Amount); moq.Verify(x => x.GetAccountAmountAsync(accountId)); }
public async Task AccountInfo_SuccessesfulLocked() { var testee = new AccountInfoAsync(5, moq.Object); var tasks = Enumerable.Range(0, 3). Select(x => testee.RefreshAmountAsync()); await Task.WhenAll(tasks); moq.Verify(x => x.GetAccountAmountAsync(5), Times.Once()); Assert.Equal(32, testee.Amount); }
public async Task AccountInfo_MultipleCalls() { var testee = new AccountInfoAsync(5, moq.Object); await testee.RefreshAmountAsync(); await testee.RefreshAmountAsync(); await testee.RefreshAmountAsync(); moq.Verify(x => x.GetAccountAmountAsync(5), Times.Exactly(3)); Assert.Equal(32, testee.Amount); }
public void AccouuntInfo_Amount_DidntChange(int accountId) { var testee = new AccountInfoAsync(accountId, moq.Object); Assert.Equal(0, testee.Amount); }
public void AccountInfo_Fail(int accountId) { var testee = new AccountInfoAsync(accountId, moq.Object); Assert.ThrowsAsync <InvalidOperationException>(() => testee.RefreshAmountAsync()); }