summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs')
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs26
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);
}
}
}