public void Submit_PerformsCorrectRequest()
        {
            //setup
            var request = new SavedSearchRetrieveRequestStub("DevKey", "api.careerbuilder.com", "", "", 12345);
            var dummyApp = new SavedSearchRetrieveRequestModel();

            //Mock
            var response = new RestResponse<SavedSearchRetrieveResponseModel> { Data = new SavedSearchRetrieveResponseModel(), ResponseStatus = ResponseStatus.Completed };
            var restReq = new Mock<IRestRequest>();

            restReq.Setup(x => x.AddParameter("DeveloperKey", dummyApp.DeveloperKey));
            restReq.Setup(x => x.AddParameter("ExternalUserID", dummyApp.ExternalUserID));
            restReq.Setup(x => x.AddParameter("ExternalID", dummyApp.ExternalID));



            var restClient = new Mock<IRestClient>();
            restClient.SetupSet(x => x.BaseUrl = "https://api.careerbuilder.com/v1/SavedSearch/retrieve");
            restClient.Setup(x => x.Execute<SavedSearchRetrieveResponseModel>(It.IsAny<IRestRequest>())).Returns(response);

            request.Request = restReq.Object;
            request.Client = restClient.Object;

            //Assertions
            SavedSearchRetrieveResponseModel rest = request.Submit(dummyApp);
            restReq.VerifyAll();
            restClient.VerifyAll();
        }
 public SavedSearchRetrieveResponseModel Submit(SavedSearchRetrieveRequestModel search)
 {
     _request.AddParameter("DeveloperKey", search.DeveloperKey);
     _request.AddParameter("ExternalUserID", search.ExternalUserID);
     _request.AddParameter("ExternalID", search.ExternalID);
     base.BeforeRequest();
     search.DeveloperKey = DeveloperKey;
     IRestResponse<SavedSearchRetrieveResponseModel> response = _client.Execute<SavedSearchRetrieveResponseModel>(_request);
     CheckForErrors(response);
     return response.Data;
 }
Example #3
0
 /// <summary>
 /// Retrieve a single saved search
 /// </summary>
 /// <param name="app">Info to lead to the saved search</param>
 /// <returns></returns>
 public SavedSearchRetrieveResponseModel RetrieveSavedSearch(SavedSearchRetrieveRequestModel app) {
     var req = new SavedSearchRetrieveRequest(_Settings);
     WireBeforeRequestEvents(req);
     WireAfterRequestEvents(req);
     return req.Submit(app);
 }