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

            //Mock
            var response = new RestResponse<SavedSearchUpdateResponseModel> { Data = new SavedSearchUpdateResponseModel(), ResponseStatus = ResponseStatus.Completed };
            var restReq = new Mock<IRestRequest>();
            restReq.Setup(x => x.AddBody(dummyApp));



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

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

            //Assertions
            SavedSearchUpdateResponseModel rest = request.Submit(dummyApp);
            restReq.VerifyAll();
            restClient.VerifyAll();
        }
 public SavedSearchUpdateResponseModel Submit(SavedSearchUpdateRequestModel search)
 {
     _request.AddBody(search);
     base.BeforeRequest();
     search.DeveloperKey = DeveloperKey;
     IRestResponse<SavedSearchUpdateResponseModel> response = _client.Execute<SavedSearchUpdateResponseModel>(_request);
     CheckForErrors(response);
     return response.Data;
 }
Esempio n. 3
0
 /// <summary>
 /// Updates a SavedSearch
 /// </summary>
 /// <param name="app">The data for the savedsearch</param>
 /// <returns></returns>
 public SavedSearchUpdateResponseModel UpdateSavedSearch(SavedSearchUpdateRequestModel app) {
     var req = new SavedSearchUpdateRequest(_Settings);
     WireBeforeRequestEvents(req);
     WireAfterRequestEvents(req);
     return req.Submit(app);
 }