예제 #1
0
        public void WhenIMakeARequestToReturnAListFromTo(string method, string uri, string payload)
        {
            Assert.IsTrue(HTTPRest.CheckEndpoint(_baseURL));
            var url = _baseURL + uri;

            try
            {
                string rtn = HTTPRest.MakeHTTPRequest(method, url, payload);
                if (uri.ToLower().Contains("isalive"))
                {
                    Assert.IsEmpty(rtn);
                }
                else if (uri.ToLower().Contains("dto"))
                {
                    _receivedObjects = JsonUtils.GetObjectArray <HighlightAlertDTO>(rtn);
                }
                else if (uri.ToLower().Contains("highlightalert"))
                {
                    _receivedObjects = JsonUtils.GetObjectArray <HighlightAlert>(rtn);
                }
                else
                {
                    Assert.IsTrue(false, "The uri supplied did not match an expected endpoint ");
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                _receivedObjects = new List <object>();
            }
        }
예제 #2
0
        public void WhenIHaveResetTheDatabase()
        {
            Assert.IsTrue(HTTPRest.CheckEndpoint(_baseURL));
            var url = _baseURL + "users/resettables";
            //hard-coded key as rough security measure on this call
            string rtn = HTTPRest.MakeHTTPRequest("POST", url, "'wf80ywef0w87efg0gwefrb09'");

            Assert.IsTrue(rtn.Length == 0, "No return was expected - please check the logs");
        }
예제 #3
0
        public void ThenWhenIMakeARequestToAnItemShouldHaveAPropertySetTo(string method, string uri, string property, string propertyValue)
        {
            Assert.IsTrue(method.Length > 0);
            Assert.IsTrue(uri.Length > 0);
            Assert.IsTrue(property.Length > 0);
            Assert.IsTrue(propertyValue.Length > 0);

            var    url = _baseURL + uri;
            string rtn = HTTPRest.MakeHTTPRequest(method, url, "");
        }
        public void WhenIMakeARequestToReturnAListFromTo(string method, string uri, string payload)
        {
            Assert.IsTrue(HTTPRest.CheckEndpoint(_baseURL));
            var url = _baseURL + uri;

            try
            {
                string rtn = HTTPRest.MakeHTTPRequest(method, url, payload);
                _receivedObjects = JsonUtils.GetObjectArray <List <object> >(rtn);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                _receivedObjects = new List <object>();
            }
        }
        public void WhenIMakeARequestToReturnAListFromWithADateSetToLastHour(string method, string uri)
        {
            Assert.IsTrue(HTTPRest.CheckEndpoint(_baseURL));
            var date = DateTime.Today.AddHours(-1);
            var url  = _baseURL + uri + "?date=" + date.ToString("yyyy-MM-ddThh:mm:ss");

            try
            {
                string rtn = HTTPRest.MakeHTTPRequest(method, url, "");
                _receivedObjects = JsonUtils.GetObjectArray <List <object> >(rtn);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                _receivedObjects = new List <object>();
            }
        }
예제 #6
0
        public void WhenIMakeARequestTo(string method, string uri, string payload)
        {
            Assert.IsTrue(HTTPRest.CheckEndpoint(_baseURL));
            var url = _baseURL + uri;

            string rtn = HTTPRest.MakeHTTPRequest(method, url, payload);

            if (uri.ToLower().Contains("isalive"))
            {
                Assert.Pass();
            }
            else if (uri.ToLower().Contains("authenticate"))
            {
                _receivedObject = rtn.Length > 0 ? rtn.Split("token=").Last() : "";
            }
            else if (uri.ToLower().Contains("decrypt"))
            {
                _receivedObject = rtn;
            }
            else if (uri.ToLower().Contains("cookie"))
            {
                _receivedObject = rtn;
            }
            else if (uri.ToLower().Contains("webhook"))
            {
                _receivedObject = JsonUtils.GetObject <HighlightAlertDTO>(rtn);
            }
            else if (uri.ToLower().Contains("highlightalert"))
            {
                _receivedObject = JsonUtils.GetObject <HighlightAlert>(rtn);
            }
            else
            {
                Assert.IsTrue(false, "The uri supplied did not match an expected endpoint ");
            }
        }