public void ListAll_PerformsCorrectRequest() { //Setup EmployeeTypesStub request = new EmployeeTypesStub("DevKey", "api.careerbuilder.com"); //Mock crap RestResponse<List<EmployeeType>> response = new RestResponse<List<EmployeeType>>(); response.Data = new List<EmployeeType>(); var restReq = new Mock<IRestRequest>(); restReq.Setup(x => x.AddParameter("DeveloperKey", "DevKey")); restReq.Setup(x => x.AddParameter("CountryCode", "NL")); restReq.SetupSet(x => x.RootElement = "EmployeeTypes"); var restClient = new Mock<IRestClient>(); restClient.SetupSet(x => x.BaseUrl = "https://api.careerbuilder.com/v1/employeetypes"); restClient.Setup(x => x.Execute<List<EmployeeType>>(It.IsAny<IRestRequest>())).Returns(response); request.Request = restReq.Object; request.Client = restClient.Object; //Assert List<EmployeeType> cats = request.WhereCountryCode(CountryCode.NL).ListAll(); Assert.IsTrue(cats.Count == 0); restReq.VerifyAll(); restClient.VerifyAll(); }
public void WhereHostSite_SetsCountryCode() { EmployeeTypesStub request = new EmployeeTypesStub("DevKey", "api.careerbuilder.com"); request.WhereHostSite(HostSite.EU); Assert.AreEqual("EU", request.CountryCode); }
public void WhereHostSite_ReturnsCategoryRequest() { EmployeeTypesStub request = new EmployeeTypesStub("DevKey", "api.careerbuilder.com"); Assert.IsInstanceOfType(request.WhereHostSite(HostSite.EU), typeof(IEmployeeTypesRequest)); }
public void WhereCountryCode_SetsCountryCode() { EmployeeTypesStub request = new EmployeeTypesStub("DevKey", "api.careerbuilder.com"); request.WhereCountryCode(CountryCode.SE); Assert.AreEqual("SE", request.CountryCode); }
public void WhereCountryCode_ReturnsCategoryRequest() { EmployeeTypesStub request = new EmployeeTypesStub("DevKey", "api.careerbuilder.com"); Assert.IsInstanceOfType(request.WhereCountryCode(CountryCode.SE),typeof(IEmployeeTypesRequest)); }
public void GetRequestURL_BuildsCorrectEndpointAddress() { EmployeeTypesStub request = new EmployeeTypesStub("DevKey", "api.careerbuilder.com"); Assert.AreEqual("https://api.careerbuilder.com/v1/employeetypes", request.RequestURL); }