summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnencryptedResponseTests.cs
blob: 99a0ed9de4bd5d2600d2346a46bed287b7b3b987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//-----------------------------------------------------------------------
// <copyright file="AssociateUnencryptedResponseTests.cs" company="Outercurve Foundation">
//     Copyright (c) Outercurve Foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.Test.OpenId.Messages {
	using System;
	using DotNetOpenAuth.Messaging;
	using DotNetOpenAuth.OpenId;
	using DotNetOpenAuth.OpenId.Messages;
	using NUnit.Framework;

	[TestFixture]
	public class AssociateUnencryptedResponseTests : OpenIdTestBase {
		private AssociateUnencryptedResponse response;

		[SetUp]
		public override void SetUp() {
			base.SetUp();
			var request = new AssociateUnencryptedRequest(Protocol.V20.Version, new Uri("http://host"));
			this.response = new AssociateUnencryptedResponse(request.Version, request);
		}

		[Test]
		public void ParameterNames() {
			this.response.AssociationHandle = "HANDLE";
			this.response.AssociationType = "HMAC-SHA1";
			this.response.SessionType = "DH-SHA1";
			this.response.ExpiresIn = 50;

			MessageSerializer serializer = MessageSerializer.Get(this.response.GetType());
			var fields = this.MessageDescriptions.GetAccessor(this.response).Serialize();
			Assert.AreEqual(Protocol.OpenId2Namespace, fields["ns"]);
			Assert.AreEqual("HANDLE", fields["assoc_handle"]);
			Assert.AreEqual("HMAC-SHA1", fields["assoc_type"]);
			Assert.AreEqual("DH-SHA1", fields["session_type"]);
			Assert.AreEqual("50", fields["expires_in"]);
		}

		[Test]
		public void RequiredProtection() {
			Assert.AreEqual(MessageProtections.None, this.response.RequiredProtection);
		}

		[Test]
		public void Transport() {
			Assert.AreEqual(MessageTransport.Direct, this.response.Transport);
		}
	}
}