public void Constructor_ThrowsException_WhenPassedBadJobDID()
 {
     try
     {
         JobRequestStub request = new JobRequestStub("W3T1SK6PN85V725Z6Q3", "DevKey", "api.careerbuilder.com", "", "");
         Assert.Fail();
     }
     catch (ArgumentException ex)
     {
         Assert.IsInstanceOfType(ex, typeof(ArgumentException));
     }
 }
 public void Constructor_ThrowsException_WhenPassedLongJobDID()
 {
     try
     {
         JobRequestStub request = new JobRequestStub("J12345678901234567890123456789", "DevKey", "api.careerbuilder.com", "", "");
         Assert.Fail();
     }
     catch (ArgumentException ex)
     {
         Assert.IsInstanceOfType(ex, typeof(ArgumentException));
     }
 }
        public void Retrieve_PerformsCorrectRequest()
        {
            //Setup
            JobRequestStub request = new JobRequestStub("J3T1SK6PN85V725Z6Q3", "DevKey", "api.careerbuilder.com", "", "");
            
            //Mock crap
            RestResponse<Job> response = new RestResponse<Job>();
            response.Data = new Job() {JobTitle="Jeff's crazy job imporieum"};
                        
            var restReq = new Mock<IRestRequest>();
            restReq.Setup(x => x.AddParameter("DeveloperKey", "DevKey"));
            restReq.Setup(x => x.AddParameter("DID", "J3T1SK6PN85V725Z6Q3"));
            restReq.SetupSet(x => x.RootElement = "Job");

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

            request.Request = restReq.Object;
            request.Client = restClient.Object;
            
            //Assert
            Job myJob = request.Retrieve();
            Assert.AreSame(response.Data, myJob);
            restReq.VerifyAll();
            restClient.VerifyAll();
        }
 public void Constructor_SetsJobDID()
 {
     try
     {
         JobRequestStub request = new JobRequestStub("J3T1SK6PN85V725Z6Q3", "DevKey", "api.careerbuilder.com", "", "");
         Assert.AreEqual("J3T1SK6PN85V725Z6Q3", request.JobDID);
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }