public void ListAll_PerformsCorrectRequest()
        {
            //Setup
            CategoriesStub request = new CategoriesStub("DevKey", "api.careerbuilder.com","","");
            
            //Mock crap
            RestResponse<List<Category>> response = new RestResponse<List<Category>>();
            response.Data = new List<Category>();
                        
            var restReq = new Mock<IRestRequest>();
            restReq.Setup(x => x.AddParameter("DeveloperKey", "DevKey"));
            restReq.Setup(x => x.AddParameter("CountryCode", "NL"));
            restReq.SetupSet(x => x.RootElement = "Categories");

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

            request.Request = restReq.Object;
            request.Client = restClient.Object;
            
            //Assert
            List<Category> cats = request.WhereCountryCode(CountryCode.NL).ListAll();
            Assert.IsTrue(cats.Count == 0);
            restReq.VerifyAll();
            restClient.VerifyAll();
        }
 public void WhereHostSite_SetsCountryCode()
 {
     CategoriesStub request = new CategoriesStub("DevKey", "api.careerbuilder.com","","");
     request.WhereHostSite(HostSite.EU);
     Assert.AreEqual("EU", request.CountryCode);
 }
 public void WhereHostSite_ReturnsCategoryRequest()
 {
     CategoriesStub request = new CategoriesStub("DevKey", "api.careerbuilder.com","","");
     Assert.IsInstanceOfType(request.WhereHostSite(HostSite.EU), typeof(ICategoryRequest));
 }
 public void WhereCountryCode_SetsCountryCode()
 {
     CategoriesStub request = new CategoriesStub("DevKey", "api.careerbuilder.com","","");
     request.WhereCountryCode(CountryCode.SE);
     Assert.AreEqual("SE", request.CountryCode);
 }
 public void WhereCountryCode_ReturnsCategoryRequest()
 {
     CategoriesStub request = new CategoriesStub("DevKey", "api.careerbuilder.com","","");
     Assert.IsInstanceOfType(request.WhereCountryCode(CountryCode.SE),typeof(ICategoryRequest));
 }
 public void GetRequestURL_BuildsCorrectEndpointAddress()
 {
     CategoriesStub request = new CategoriesStub("DevKey", "api.careerbuilder.com","","");
     Assert.AreEqual("https://api.careerbuilder.com/v1/categories", request.RequestURL);
 }
 public void Constructor_DefaultsToUSCountryCode()
 {
     CategoriesStub request = new CategoriesStub("DevKey","api.careerbuilder.com","","");
     Assert.AreEqual("US", request.CountryCode);
 }