private static void TestSerializeDeserialize(string serialized, UserState deserialized)
        {
            // Test Serialization
            Assert.AreEqual(serialized, deserialized.Serialize());

            // Test Deserialization
            var actual = UserState.Deserialize(serialized);
            Assert.AreEqual(deserialized.UserName, actual.UserName);
            AssertArray.AreEqual(deserialized.Roles.ToArray(), actual.Roles.ToArray());
        }
 public CabalAuthenticationTicket(UserState state)
 {
     UserState = state;
     ticket = new FormsAuthenticationTicket(
         1,            // version
         state.UserName,     // auth name (userid)0
         DateTime.Now, // issued date
         DateTime.Now.AddMinutes(60 * 4), // expires
         false,          // isPersistent
         state.Serialize());      // serialized UserState (can not be null)
 }