Beispiel #1
0
        private string UnmarshalCookieVersion1(string serializedWebConnectionInfo)
        {
            string[] lengthAndData  = serializedWebConnectionInfo.Split(new[] { '-' }, 2);
            string   compressedData = lengthAndData[1];

            return(_cookieDataManager.Decompress(compressedData));
        }
        private static WebConnectionInfo MockCookieDataManager(IServiceLocator serviceLocator)
        {
            WebConnectionInfo webConnectionInfo = new WebConnectionInfo {
                UserAuthToken = "test"
            };
            string serializedWebConnectionInfo = JsonConvert.SerializeObject(
                webConnectionInfo,
                new JsonSerializerSettings {
                Converters = { new WebConnectionInfoConverter() }
            });

            ICookieDataManager cookieDataManager = Substitute.For <ICookieDataManager>();

            cookieDataManager.Decompress(Arg.Any <string>()).Returns(serializedWebConnectionInfo);

            serviceLocator.GetInstance <ICookieDataManager>().Returns(cookieDataManager);
            return(webConnectionInfo);
        }