private Hashtable ConvertMetaDataToHashtable(IdpMetaDataResponse idpMetaData)
        {
            Hashtable result = new Hashtable();

            foreach (PropertyInfo property in idpMetaData.GetType().GetProperties())
            {
                DataMemberAttribute attribute = property.GetCustomAttribute <DataMemberAttribute>(true);
                if (IsValidDataMemberAttribute(attribute))
                {
                    result.Add(attribute.Name, property.GetValue(idpMetaData));
                }
                else
                {
                    result.Add(property.Name, property.GetValue(idpMetaData));
                }
            }
            return(result);
        }
        public void GivenIdpMetaData_WhenSerialize_ThenReturnParseResult()
        {
            IdpMetaDataResponse idpMetadata = new IdpMetaDataResponse()
            {
                AuthId             = "my_auth_id",
                AuthName           = "my_auth_name",
                Protocol           = 1,
                IdPIssuer          = "my_issuer",
                IdPSsoUrl          = "sso_url",
                IdPCertificate     = "idp_cert",
                SpCertificate      = "sp_cert",
                SignatureAlgorithm = "algorithm",
                Status             = 1
            };

            string result = serializer.Serialize(idpMetadata);

            StringAssert.Contains("s:7:\"auth_id\"", result);
            StringAssert.Contains("s:10:\"my_auth_id\"", result);

            StringAssert.Contains("s:9:\"auth_name\"", result);
            StringAssert.Contains("s:12:\"my_auth_name\"", result);

            StringAssert.Contains("s:8:\"protocol\"", result);
            StringAssert.Contains("i:1;", result);

            StringAssert.Contains("s:10:\"idp_issuer\"", result);
            StringAssert.Contains("s:9:\"my_issuer\"", result);

            StringAssert.Contains("s:11:\"idp_sso_url\"", result);
            StringAssert.Contains("s:7:\"sso_url\"", result);

            StringAssert.Contains("s:15:\"idp_certificate\"", result);
            StringAssert.Contains("s:8:\"idp_cert\"", result);

            StringAssert.Contains("s:14:\"sp_certificate\"", result);
            StringAssert.Contains("s:7:\"sp_cert\"", result);

            StringAssert.Contains("s:19:\"signature_algorithm\"", result);
            StringAssert.Contains("s:9:\"algorithm\"", result);

            StringAssert.Contains("s:6:\"status\"", result);
            StringAssert.Contains("i:1;", result);
        }