blob: 1418513a3d5bac01760e7b7dfb8e1bff162acd41 (
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
|
//-----------------------------------------------------------------------
// <copyright file="PositiveAnonymousResponseTests.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using System;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class PositiveAnonymousResponseTests : OpenIdTestBase {
private readonly Realm realm = new Realm("http://localhost/rp.aspx");
private readonly Uri returnTo = new Uri("http://localhost/rp.aspx");
[TestInitialize]
public override void SetUp() {
base.SetUp();
}
/// <summary>
/// Verifies that the Status property returns the correct value.
/// </summary>
[TestMethod]
public void CtorAndProperties() {
var responseMessage = new IndirectSignedResponse(Protocol.V20.Version, this.returnTo);
var ext = new ClaimsResponse();
responseMessage.Extensions.Add(ext);
var response = new PositiveAnonymousResponse(responseMessage);
Assert.AreEqual(AuthenticationStatus.ExtensionsOnly, response.Status);
Assert.AreSame(responseMessage, response.Response);
Assert.IsNull(response.ClaimedIdentifier);
Assert.IsNull(response.FriendlyIdentifierForDisplay);
Assert.IsNull(response.Exception);
Assert.IsNull(response.Provider);
Assert.AreSame(ext, response.GetUntrustedExtension<ClaimsResponse>());
}
/// <summary>
/// Verifies the Provider property.
/// </summary>
[TestMethod]
public void ProviderTest() {
var responseMessage = new IndirectSignedResponse(Protocol.V20.Version, this.returnTo);
responseMessage.ProviderEndpoint = OPUri;
var response = new PositiveAnonymousResponse(responseMessage);
Assert.IsNotNull(response.Provider);
Assert.AreEqual(OPUri, response.Provider.Uri);
Assert.AreEqual(responseMessage.Version, response.Provider.Version);
}
}
}
|