AX feature complete, with tests passing.
[dotnetoauth.git] / src / DotNetOpenAuth.Test / OpenId / Extensions / AttributeExchange / FetchResponseTests.cs
blob3f0149854f186fae411f59a509e6c248b894ea9a
1 //-----------------------------------------------------------------------
2 // <copyright file="FetchResponseTests.cs" company="Andrew Arnott">
3 // Copyright (c) Andrew Arnott. All rights reserved.
4 // </copyright>
5 //-----------------------------------------------------------------------
7 namespace DotNetOpenId.Test.OpenId.Extensions {
8 using System;
9 using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
10 using DotNetOpenAuth.Test.OpenId;
11 using Microsoft.VisualStudio.TestTools.UnitTesting;
13 [TestClass]
14 public class FetchResponseTests : OpenIdTestBase {
15 [TestMethod]
16 public void AddAttribute() {
17 var response = new FetchResponse();
18 response.AddAttribute(new AttributeValues("http://someattribute", "Value1"));
21 [TestMethod]
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);
41 [TestMethod]
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);