public async Task WhenNonceIsVerified_RegistersNewNonceInTheStore() { A.CallTo(() => _nonceStore.Get(A <KeyId> ._, A <string> ._)) .Returns((Nonce)null); Nonce interceptedNonce = null; A.CallTo(() => _nonceStore.Register(A <Nonce> ._)) .Invokes(call => interceptedNonce = call.GetArgument <Nonce>(0)) .Returns(Task.CompletedTask); await _method(_signedRequest, _signature, _client); var expectedNonce = new Nonce(_client.Id, _signature.Nonce, _now.Add(_client.NonceLifetime)); interceptedNonce.Should().BeEquivalentTo(expectedNonce); }