コード例 #1
0
        public void OAuth2ParametersStorageJson_loadEmpty_shouldLoadDefaults_test()
        {
            var appid = Guid.NewGuid();
            UserResourceManager.Create(appid, HttpApplicationInfoIntegratonObject(), FileSystemWrapperObject());
            var res = UserResourceManager.Get(appid, HttpApplicationInfoIntegratonObject(), FileSystemWrapperObject());

            var aa = new OAuth2ParametersStorageJson(res);

            aa.Load();

            Assert.IsNull(aa.Parameters.ClientId);
        }
コード例 #2
0
        public void OAuth2ParametersStorageJson_test()
        {
            var appid = Guid.NewGuid();
            UserResourceManager.Create(appid, HttpApplicationInfoIntegratonObject(), FileSystemWrapperObject());
            var res = UserResourceManager.Get(appid, HttpApplicationInfoIntegratonObject(), FileSystemWrapperObject());

            var parameters = new OAuth2Parameters()
                {
                    AccessCode = "AccessCode",
                    AccessToken = "Access token",
                    ClientId = "client id",
                    ClientSecret = "Client secret",
                    TokenExpiry = DateTime.Now
                };
            var aa = new OAuth2ParametersStorageJson(parameters, res);

            aa.Save();

            var newValues = new OAuth2ParametersStorageJson(res);
            newValues.Load();

            Assert.AreEqual("client id", newValues.Parameters.ClientId);
        }