diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-26 11:19:06 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-26 11:19:06 -0700 |
commit | 3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb (patch) | |
tree | c15816c3d7f6e74334553f2ff98605ce1c22c538 /src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs | |
parent | 5e9014f36b2d53b8e419918675df636540ea24e2 (diff) | |
parent | e6f7409f4caceb7bc2a5b4ddbcb1a4097af340f2 (diff) | |
download | DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.zip DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.tar.gz DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.tar.bz2 |
Move to HttpClient throughout library.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs')
-rw-r--r-- | src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs b/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs index 9a46e42..04c63ef 100644 --- a/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs +++ b/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs @@ -9,6 +9,8 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings { using System.Collections.Generic; using System.Linq; using System.Text; + using System.Threading; + using System.Threading.Tasks; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OpenId; @@ -40,14 +42,14 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings { /// Verifies that the generated nonce includes random characters. /// </summary> [Test] - public void RandomCharactersTest() { - Assert.IsNotNull(this.nonceElement.ProcessOutgoingMessage(this.message)); + public async Task RandomCharactersTest() { + Assert.IsNotNull(await this.nonceElement.ProcessOutgoingMessageAsync(this.message, CancellationToken.None)); Assert.IsNotNull(this.message.Nonce, "No nonce was set on the message."); Assert.AreNotEqual(0, this.message.Nonce.Length, "The generated nonce was empty."); string firstNonce = this.message.Nonce; // Apply another nonce and verify that they are different than the first ones. - Assert.IsNotNull(this.nonceElement.ProcessOutgoingMessage(this.message)); + Assert.IsNotNull(await this.nonceElement.ProcessOutgoingMessageAsync(this.message, CancellationToken.None)); Assert.IsNotNull(this.message.Nonce, "No nonce was set on the message."); Assert.AreNotEqual(0, this.message.Nonce.Length, "The generated nonce was empty."); Assert.AreNotEqual(firstNonce, this.message.Nonce, "The two generated nonces are identical."); @@ -57,41 +59,41 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings { /// Verifies that a message is received correctly. /// </summary> [Test] - public void ValidMessageReceivedTest() { + public async Task ValidMessageReceivedTest() { this.message.Nonce = "a"; - Assert.IsNotNull(this.nonceElement.ProcessIncomingMessage(this.message)); + Assert.IsNotNull(await this.nonceElement.ProcessIncomingMessageAsync(this.message, CancellationToken.None)); } /// <summary> /// Verifies that a message that doesn't have a string of random characters is received correctly. /// </summary> [Test] - public void ValidMessageNoNonceReceivedTest() { + public async Task ValidMessageNoNonceReceivedTest() { this.message.Nonce = string.Empty; this.nonceElement.AllowZeroLengthNonce = true; - Assert.IsNotNull(this.nonceElement.ProcessIncomingMessage(this.message)); + Assert.IsNotNull(await this.nonceElement.ProcessIncomingMessageAsync(this.message, CancellationToken.None)); } /// <summary> /// Verifies that a message that doesn't have a string of random characters is received correctly. /// </summary> [Test, ExpectedException(typeof(ProtocolException))] - public void InvalidMessageNoNonceReceivedTest() { + public async Task InvalidMessageNoNonceReceivedTest() { this.message.Nonce = string.Empty; this.nonceElement.AllowZeroLengthNonce = false; - Assert.IsNotNull(this.nonceElement.ProcessIncomingMessage(this.message)); + Assert.IsNotNull(await this.nonceElement.ProcessIncomingMessageAsync(this.message, CancellationToken.None)); } /// <summary> /// Verifies that a replayed message is rejected. /// </summary> [Test, ExpectedException(typeof(ReplayedMessageException))] - public void ReplayDetectionTest() { + public async Task ReplayDetectionTest() { this.message.Nonce = "a"; - Assert.IsNotNull(this.nonceElement.ProcessIncomingMessage(this.message)); + Assert.IsNotNull(await this.nonceElement.ProcessIncomingMessageAsync(this.message, CancellationToken.None)); // Now receive the same message again. This should throw because it's a message replay. - this.nonceElement.ProcessIncomingMessage(this.message); + await this.nonceElement.ProcessIncomingMessageAsync(this.message, CancellationToken.None); } } } |