Ejemplo n.º 1
0
        public void WhereCountryCode_SetsCountryCode()
        {
            EducationCodesRequestStub request = new EducationCodesRequestStub("DevKey", "api.careerbuilder.com", "", "");

            request.WhereCountryCode(CountryCode.SE);

            Assert.AreEqual("SE", request.CountryCode);
        }
Ejemplo n.º 2
0
        public void WhereCountryCode_IsFluent()
        {
            IEducationCodesRequest target = new EducationCodesRequestStub("DevKey", "api.careerbuilder.com", "", "");

            IEducationCodesRequest actual = target.WhereCountryCode(CountryCode.SE);

            Assert.AreEqual(actual, target);
        }
Ejemplo n.º 3
0
        public void ListAll_PerformsCorrectRequest()
        {
            EducationCodesRequestStub        target   = new EducationCodesRequestStub("DevKey", "api.careerbuilder.com", "", "");
            RestResponse <List <Education> > response = new RestResponse <List <Education> > {
                Data = new List <Education>()
            };
            Mock <IRestRequest> request = new Mock <IRestRequest>();

            request.Setup(x => x.AddParameter("DeveloperKey", "DevKey"));
            request.Setup(x => x.AddParameter("CountryCode", "NL"));
            request.SetupSet(x => x.RootElement = "EducationCodes");
            Mock <IRestClient> restClient = new Mock <IRestClient>();

            restClient.SetupSet(x => x.BaseUrl = "https://api.careerbuilder.com/v1/educationcodes");
            restClient.Setup(x => x.Execute <List <Education> >(It.IsAny <IRestRequest>())).Returns(response);
            target.Request = request.Object;
            target.Client  = restClient.Object;

            List <Education> educationCodes = target.WhereCountryCode(CountryCode.NL).ListAll();

            Assert.IsTrue(educationCodes.Count == 0);
            request.VerifyAll();
            restClient.VerifyAll();
        }