Exemplo n.º 1
0
 public FSEDataRequest(FSEDataRequestType requestType, string url, DateTime timeStamp)
 {
     this.requestType = requestType;
     this.url         = url;
     request          = (HttpWebRequest)WebRequest.Create(url);
     this.timeStamp   = timeStamp;
     setRequestQuery();
 }
Exemplo n.º 2
0
        public FSEDataRequest(string requestObjAsString)
        {
            //split it into parts
            string[] objParts = requestObjAsString.Split(',');

            //TODO: some validation here could help incase the file gets modifed outside of the program

            requestType = (FSEDataRequestType)Enum.Parse(typeof(FSEDataRequestType), objParts[0]);
            //requestQuery = objParts[1];
            url       = objParts[1];
            timeStamp = DateTime.Parse(objParts[2]);
            request   = (HttpWebRequest)WebRequest.Create(url);
            setRequestQuery();
        }
        public void GetOldestRequest_ReturnsCorrectResult()
        {
            //in this setup the Aircraft_By_MakeModel request is the older of the two requests
            FSEDataRequestType OLDEST_REQUEST_TYPE = FSEDataRequestType.Aircraft_By_MakeModel;


            FSEDataRequestTracker requests = new FSEDataRequestTracker();

            requests.AddRequest(new FSEDataRequest(FSEDataRequestType.Aircraft_By_MakeModel, SAMPLE_VALID_MAKEMODEL_URL));
            Thread.Sleep(1000);
            requests.AddRequest(new FSEDataRequest(FSEDataRequestType.ICAO_Jobs_From, SAMPLE_VALID_ICAOJOBSFROM_URL));


            Assert.IsTrue(requests.GetOldestRequest().GetRequestType().Equals(OLDEST_REQUEST_TYPE));
        }