blob: 6fb693d6b7f7e13c6a9edf9cf7cb75ce195df145 (
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using DotNetOpenId.Extensions.ProviderAuthenticationPolicy;
namespace DotNetOpenId.Test.Extensions {
[TestFixture]
public class PapeTests : ExtensionTestBase {
[Test]
public void None() {
var response = ParameterizedTest<PolicyResponse>(
TestSupport.Scenarios.ExtensionFullCooperation, Version, null);
Assert.IsNull(response);
}
[Test]
public void Full() {
var request = new PolicyRequest();
request.MaximumAuthenticationAge = TimeSpan.FromMinutes(10);
request.PreferredAuthLevelTypes.Add(Constants.AuthenticationLevels.NistTypeUri);
var response = ParameterizedTest<PolicyResponse>(
TestSupport.Scenarios.ExtensionFullCooperation, Version, request);
Assert.IsNotNull(response);
Assert.IsNotNull(response.AuthenticationTimeUtc);
Assert.IsTrue(response.AuthenticationTimeUtc.Value > DateTime.UtcNow - request.MaximumAuthenticationAge);
Assert.IsTrue(response.AssuranceLevels.ContainsKey(Constants.AuthenticationLevels.NistTypeUri));
Assert.AreEqual("1", response.AssuranceLevels[Constants.AuthenticationLevels.NistTypeUri]);
Assert.AreEqual(NistAssuranceLevel.Level1, response.NistAssuranceLevel);
}
}
}
|