/// <summary> /// Construct the request data based on the request type /// </summary> /// <returns></returns> protected override object GetRequestParams() { var data = new Dictionary <string, object>(); if (null == _authPolicyId) { throw new ArgumentNullException("No auth policy id"); } data.Add("policyId", _authPolicyId); data.Add("device", AppConfig.GetDeviceId()); data.Add("clientToken", AppConfig.GetAppId()); Dictionary <string, string> userParams = new Dictionary <string, string>(); if (null != _authUserName && null != this._authUserPass) { userParams.Add("userId", _authUserName); userParams.Add("password", _authUserPass); } data.Add("params", userParams); string env = _cloudProps.GetEnv(); if (null != env) { data.Add("environment", env); } var defaultParams = GetDefaultParams(); data["__fh"] = defaultParams; return(data); }
public void TestReadCloudPropsWithJsonEmptyValuesForUrlAndHostWithoutUrl() { // given var json = JObject.Parse(@"{ 'hosts': {'host': 'HOST', 'environment': 'ENV', 'releaseCloudUrl': 'RELEASE_CLOUD_URL'} }"); var config = new FHConfig(new MockDeviceService()); var props = new CloudProps(json, config); // when var host = props.GetCloudHost(); var env = props.GetEnv(); // then Assert.AreEqual("RELEASE_CLOUD_URL", host); Assert.AreEqual("ENV", env); }
public void TestReadCloudPropsWithJsonContainingValues() { // given var json = JObject.Parse(@"{ 'url': 'URL', 'hosts': {'host': 'HOST', 'environment': 'ENV'} }"); var config = new FHConfig(new MockDeviceService()); var props = new CloudProps(json, config); // when var host = props.GetCloudHost(); var env = props.GetEnv(); // then Assert.AreEqual("URL", host); Assert.AreEqual("ENV", env); }