/// <summary> /// Construct the remote uri based on the request type /// </summary> /// <returns></returns> protected override Uri GetUri() { Contract.Assert(null != RemoteAct, "remote act is not defined"); var host = _cloudProps.GetCloudHost(); return(new Uri(string.Format("{0}/{1}/{2}", host, "cloud", RemoteAct))); }
/// <summary> /// Construct the remote uri based on the request type /// </summary> /// <returns></returns> protected override Uri GetUri() { var host = _cloudProps.GetCloudHost(); var pathWithoutStartingSlash = RequestPath.StartsWith("/") ? RequestPath.Substring(1) : RequestPath; return(new Uri(string.Format("{0}/{1}", host, pathWithoutStartingSlash))); }
public void TestURLFormatting() { // given var json = JObject.Parse(@"{ 'url': 'http://someserver.com/', 'hosts': {'host': 'HOST', 'environment': 'ENV'} }"); var config = new FHConfig(new MockDeviceService()); var props = new CloudProps(json, config); // when var host = props.GetCloudHost(); // then Assert.AreEqual("http://someserver.com", host); }
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); }