public async Task CanSeeRemainingTries() { //Assume is setup var ledger = GetLedger(); var verifyPinResult = await ledger.VerifyPinAsync("1234"); Assert.True(verifyPinResult.IsSuccess); verifyPinResult.Remaining = await ledger.GetRemainingAttemptsAsync(); Assert.Equal(3, verifyPinResult.Remaining); var result = await ledger.VerifyPinAsync("1235"); Assert.Equal(2, verifyPinResult.Remaining); var ex = await Assert.ThrowsAsync <LedgerWalletException>(async() => verifyPinResult.Remaining = await ledger.GetRemainingAttemptsAsync()); Assert.NotNull(ex.Status); Assert.True(ex.Status.SW == 0x6FAA); Assert.True(ex.Status.InternalSW == 0x00AA); Debugger.Break(); //Remove then insert ledger = (await LegacyLedgerClient.GetHIDLedgersAsync()).First(); verifyPinResult.Remaining = await ledger.GetRemainingAttemptsAsync(); Assert.Equal(2, verifyPinResult.Remaining); }
private static LegacyLedgerClient GetLedger() { return(LegacyLedgerClient.GetHIDLedgersAsync().GetAwaiter().GetResult().First()); }