public void ListAll_PerformsCorrectRequest() { //Setup var request = new EmployeeTypesStub("DevKey", "api.careerbuilder.com"); //Mock crap var response = new RestResponse<List<EmployeeType>> {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 WhereCountryCode_SetsCountryCode() { var request = new EmployeeTypesStub("DevKey", "api.careerbuilder.com"); request.WhereCountryCode(CountryCode.SE); Assert.AreEqual("SE", request.CountryCode); }
public void WhereCountryCode_ReturnsCategoryRequest() { var request = new EmployeeTypesStub("DevKey", "api.careerbuilder.com"); Assert.IsInstanceOfType(request.WhereCountryCode(CountryCode.SE), typeof (IEmployeeTypesRequest)); }