blob: cb5fbb546a7be5ad76d6805c996a62341b389f22 (
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
|
//-----------------------------------------------------------------------
// <copyright file="RelyingPartySecuritySettingsTests.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. 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 Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class RelyingPartySecuritySettingsTests : OpenIdTestBase {
private RelyingPartySecuritySettings settings;
[TestInitialize]
public override void SetUp() {
base.SetUp();
this.settings = new RelyingPartySecuritySettings();
}
/// <summary>
/// Verifies that the <see cref="RelyingPartySecuritySettings.RequireSsl"/> property
/// getter/setter are implemented correctly.
/// </summary>
[TestMethod]
public void RequireSsl() {
Assert.IsFalse(this.settings.RequireSsl, "Default should be to not require SSL.");
this.settings.RequireSsl = true;
Assert.IsTrue(this.settings.RequireSsl);
this.settings.RequireSsl = false;
Assert.IsFalse(this.settings.RequireSsl);
}
/// <summary>
/// Verifies that changing the <see cref="RelyingPartySecuritySettings.RequireSsl"/> property
/// fires the <see cref="RelyingPartySecuritySettings.RequireSslChanged"/> event.
/// </summary>
[TestMethod]
public void RequireSslFiresEvent() {
bool requireSslChanged = false;
this.settings.RequireSslChanged += (sender, e) => { requireSslChanged = true; };
// Setting the property to its current value should not fire event.
this.settings.RequireSsl = this.settings.RequireSsl;
Assert.IsFalse(requireSslChanged);
// Changing the property's value should fire the event.
this.settings.RequireSsl = !this.settings.RequireSsl;
Assert.IsTrue(requireSslChanged);
}
}
}
|