public ResponseApplication Submit(RequestApplication app)
 {
     base.BeforeRequest();
     _request.AddBody(app);
     IRestResponse<ResponseApplication> response = _client.Execute<ResponseApplication>(_request);
     CheckForErrors(response);
     return response.Data;
 }
        public void Submit_PerformsCorrectRequest() {
            //Setup
            var request = new SubmitApplicationRequestStub("DevKey", "api.careerbuilder.com", "", "", 12345);
            var dummyApp = new RequestApplication();

            //Mock crap
            var response = new RestResponse<ResponseApplication> { Data = new ResponseApplication(),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/v1/application/submit");
            restClient.Setup(x => x.Execute<ResponseApplication>(It.IsAny<IRestRequest>())).Returns(response);

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

            //Assert
            ResponseApplication resp = request.Submit(dummyApp);
            restReq.VerifyAll();
            restClient.VerifyAll();
        }
示例#3
0
 /// <summary>
 /// Submit an application to /v1/application/submit
 /// </summary>
 /// <param name="app">The application being submited to careerbuilder</param>
 /// <returns></returns>
 public ResponseApplication SubmitApplication(RequestApplication app) {
     var req = new SubmitApplicationRequest(_Settings);
     WireBeforeRequestEvents(req);
     WireAfterRequestEvents(req);
     return req.Submit(app);
 }
示例#4
0
 /// <summary>
 /// Submit an application to /v1/application/submit
 /// </summary>
 /// <param name="app">The application being submited to careerbuilder</param>
 /// <returns></returns>
 public ResponseApplication SubmitApplication(Application app) {
     RequestApplication req = new RequestApplication();
     req.CoBrand = app.CoBrand;
     req.DeveloperKey = app.DeveloperKey;
     req.JobDID = app.JobDID;
     req.SiteID = app.SiteID;
     req.Test = app.Test;
     req.Resume = app.Resume;
     List<Response> responses = new List<Response>();
     foreach (var item in app.Questions) {
         responses.Add(new Response() { QuestionID = item.QuestionID, ResponseText = item.ResponseText });
     }
     req.Responses = responses;
     return SubmitApplication(req);
 }