1
//-----------------------------------------------------------------------
2 // <copyright file="FetchResponseTests.cs" company="Andrew Arnott">
3 // Copyright (c) Andrew Arnott. All rights reserved.
5 //-----------------------------------------------------------------------
7 namespace DotNetOpenId
.Test
.OpenId
.Extensions
{
9 using DotNetOpenAuth
.OpenId
.Extensions
.AttributeExchange
;
10 using DotNetOpenAuth
.Test
.OpenId
;
11 using Microsoft
.VisualStudio
.TestTools
.UnitTesting
;
14 public class FetchResponseTests
: OpenIdTestBase
{
16 public void AddAttribute() {
17 var response
= new FetchResponse();
18 response
.AddAttribute(new AttributeValues("http://someattribute", "Value1"));
22 public void AddTwoAttributes() {
23 var response
= new FetchResponse();
24 response
.AddAttribute(new AttributeValues("http://someattribute", "Value1"));
25 response
.AddAttribute(new AttributeValues("http://someOtherAttribute", "Value2"));
28 [TestMethod
, ExpectedException(typeof(ArgumentException
))]
29 public void AddAttributeTwice() {
30 var response
= new FetchResponse();
31 response
.AddAttribute(new AttributeValues("http://someattribute", "Value1"));
32 response
.AddAttribute(new AttributeValues("http://someattribute", "Value1"));
35 [TestMethod
, ExpectedException(typeof(ArgumentNullException
))]
36 public void AddAttributeNull() {
37 var response
= new FetchResponse();
38 response
.AddAttribute(null);
42 public void EqualityTests() {
43 var response1
= new FetchResponse();
44 var response2
= new FetchResponse();
45 Assert
.AreEqual(response1
, response2
);
47 response1
.UpdateUrl
= new Uri("http://updateurl");
48 Assert
.AreNotEqual(response1
, response2
);
49 response2
.UpdateUrl
= new Uri("http://updateurl");
50 Assert
.AreEqual(response1
, response2
);
52 // Add attributes in different orders deliberately.
53 response1
.AddAttribute(new AttributeValues("http://att1"));
54 Assert
.AreNotEqual(response1
, response2
);
55 response2
.AddAttribute(new AttributeValues("http://att2"));
56 Assert
.AreNotEqual(response1
, response2
);
57 response1
.AddAttribute(new AttributeValues("http://att2"));
58 Assert
.AreNotEqual(response1
, response2
);
59 response2
.AddAttribute(new AttributeValues("http://att1"));
60 Assert
.AreEqual(response1
, response2
);