summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnencryptedResponseTests.cs
blob: 89609f6ecb30f29b1e86f12917db79c57ae69713 (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
//-----------------------------------------------------------------------
// <copyright file="AssociateUnencryptedResponseTests.cs" company="Andrew Arnott">
//     Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.Test.OpenId.Messages {
	using System;
	using DotNetOpenAuth.Messaging;
	using DotNetOpenAuth.OpenId;
	using DotNetOpenAuth.OpenId.Messages;
	using Microsoft.VisualStudio.TestTools.UnitTesting;

	[TestClass]
	public class AssociateUnencryptedResponseTests {
		private AssociateUnencryptedResponse response;

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

		[TestMethod]
		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 = serializer.Serialize(this.response);
			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"]);
		}

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

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