Example #1
0
        //ReportComError Options:
        //Display in message box
        //Display only in Log (with error tag put into status)
        //
        public void ReportComError(string FirstLine, RStatus R)
        {
            string Rs       = R.ToString();
            string ErrorStr = FirstLine + Environment.NewLine + "\"" + Rs + "\"" + Environment.NewLine + "Operation Canceled";

            MessageBox.Show(ErrorStr);
        }
        public void validRoadStatus()
        {
            string  strResponse   = "";
            string  strRoad       = "A40";
            string  strRequestURL = "https://api.tfl.gov.uk/road/" + strRoad;
            RStatus rStatus       = new RStatus();

            RESTclient rClient     = new RESTclient();
            bool       roadRequest = rClient.makeRequest(strRequestURL, ref strResponse);

            Assert.IsTrue(roadRequest);
        }
        public void invalidURL()
        {
            string  strResponse   = "";
            string  strRoad       = "A40";
            string  strRequestURL = "https://ap.tfl.gov.uk/road/" + strRoad;
            RStatus rStatus       = new RStatus();

            RESTclient rClient     = new RESTclient();
            bool       roadRequest = rClient.makeRequest(strRequestURL, ref strResponse);

            Assert.IsFalse(roadRequest);
            Assert.AreEqual <string>("Unable to connect to the remote server", strResponse);
        }
        public void invalidRoadStatus()
        {
            string  strResponse   = "";
            string  strRoad       = "A123";
            string  strRequestURL = "https://api.tfl.gov.uk/road/" + strRoad;
            RStatus rStatus       = new RStatus();

            RESTclient rClient     = new RESTclient();
            bool       roadRequest = rClient.makeRequest(strRequestURL, ref strResponse);

            Assert.IsFalse(roadRequest);
            Assert.AreEqual <string>("The remote server returned an error: (404) Not Found.", strResponse);
        }
Example #5
0
        public static char GetStatusVaue(RStatus aValue)
        {
            switch (aValue)
            {
            case RStatus.fsReserve:
                return(_TReserve);

            case RStatus.fsRegister:
                return(_TRegister);

            case RStatus.fsPause:
                return(_TPause);

            default:
                return(_TEmpty);
            }
        }