summaryrefslogtreecommitdiffstats
path: root/source/OpenIdTests/AssocationTestSuite.cs
blob: d2fc96de8dca394a087a32bace51766d16f7b131 (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
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Janrain.OpenId;

namespace OpenIdTests
{
    [TestFixture]
    public class AssocationTestSuite
    {

        [Test]
        public void SerializeDeserialize()
        {
            TimeSpan expiresIn = new TimeSpan(0, 0, 600);
            string handle = "handle";
            byte[] secret = ASCIIEncoding.ASCII.GetBytes("secret");
            
            
            Association assoc = new HMACSHA1Association(handle, secret, expiresIn);

            byte[] s = assoc.Serialize();

            Association assoc2 = assoc.Deserialize(s);
            

            Assert.IsTrue(assoc.Equals(assoc2));
            Assert.AreEqual(assoc.GetHashCode(), assoc2.GetHashCode());

        }

    }
}