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

namespace DotNetOpenAuth.Test.OpenId.Extensions.UI {
	using System.Globalization;
	using DotNetOpenAuth.Messaging.Reflection;
	using DotNetOpenAuth.OpenId.Extensions.UI;
	using Microsoft.VisualStudio.TestTools.UnitTesting;

	[TestClass]
	public class UIRequestTests : OpenIdTestBase {
		[TestMethod]
		public void Defaults() {
			UIRequest request = new UIRequest();
			Assert.AreEqual("popup", request.Mode);
			Assert.AreEqual(CultureInfo.CurrentUICulture, request.LanguagePreference);
		}

		[TestMethod]
		public void LanguagePreferenceEncoding() {
			var request = new UIRequest();
			request.LanguagePreference = new CultureInfo("en-US");
			MessageDictionary dictionary = this.MessageDescriptions.GetAccessor(request);
			Assert.AreEqual("en-US", dictionary["lang"]);
		}

		[TestMethod]
		public void ModeEncoding() {
			var request = new UIRequest();
			MessageDictionary dictionary = this.MessageDescriptions.GetAccessor(request);
			Assert.AreEqual("popup", dictionary["mode"]);
		}
	}
}