summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OpenId/RelyingParty/RelyingPartySecuritySettingsTests.cs
blob: 75e0607b109aa017b45e58e90219d9b57d9b36b6 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//-----------------------------------------------------------------------
// <copyright file="RelyingPartySecuritySettingsTests.cs" company="Outercurve Foundation">
//     Copyright (c) Outercurve Foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;
	using DotNetOpenAuth.OpenId.RelyingParty;
	using NUnit.Framework;

	[TestFixture]
	public class RelyingPartySecuritySettingsTests : OpenIdTestBase {
		private RelyingPartySecuritySettings settings;

		[SetUp]
		public override void SetUp() {
			base.SetUp();

			this.settings = new RelyingPartySecuritySettings();
		}

		[Test]
		public void Defaults() {
			Assert.IsFalse(this.settings.RejectUnsolicitedAssertions);
			Assert.IsFalse(this.settings.RequireSsl, "Default should be to not require SSL.");
		}

		/// <summary>
		/// Verifies that the <see cref="RelyingPartySecuritySettings.RequireSsl"/> property
		/// getter/setter are implemented correctly.
		/// </summary>
		[Test]
		public void RequireSsl() {
			this.settings.RequireSsl = true;
			Assert.IsTrue(this.settings.RequireSsl);
			this.settings.RequireSsl = false;
			Assert.IsFalse(this.settings.RequireSsl);
		}

		/// <summary>
		/// Verifies that the <see cref="RelyingPartySecuritySettings.RequireDirectedIdentity"/>
		/// property getter/setter are implemented correctly.
		/// </summary>
		[Test]
		public void RequireDirectedIdentity() {
			this.settings.RequireDirectedIdentity = true;
			Assert.IsTrue(this.settings.RequireDirectedIdentity);
			this.settings.RequireDirectedIdentity = false;
			Assert.IsFalse(this.settings.RequireDirectedIdentity);
		}

		/// <summary>
		/// Verifies that the <see cref="RelyingPartySecuritySettings.RequireAssociation"/>
		/// property getter/setter are implemented correctly.
		/// </summary>
		[Test]
		public void RequireAssociation() {
			this.settings.RequireAssociation = true;
			Assert.IsTrue(this.settings.RequireAssociation);
			this.settings.RequireAssociation = false;
			Assert.IsFalse(this.settings.RequireAssociation);
		}
	}
}