예제 #1
0
        /// <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)));
        }
예제 #2
0
        /// <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)));
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }