예제 #1
0
        public void CanAuthenticate()
        {
            const string requestXml = "<?xml version=\"1.0\" encoding=\"utf-16\"?><jobs companyid=\"348\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"jobschema.xsd\"></jobs>";
            string       response;

            var channel = _channelManager.Create();

            try
            {
                response = channel.Sync(requestXml, Username, Password);
            }
            catch (Exception)
            {
                _channelManager.Abort(channel);
                throw;
            }
            _channelManager.Close(channel);

            Assert.AreEqual("0 rows processed", response);
        }
예제 #2
0
        public void CanUpdateJob()
        {
            AssertServiceAvailable();

            var addRequest = new AddVacancyRequestMessage
            {
                Security = new Services.External.JobSearch.Security {
                    UsernameToken = _usernameToken
                },
                Body = new AddVacancyRequestBody
                {
                    orgCode              = OrgCode,
                    siteCode             = SiteCode,
                    employerID           = EmployerId,
                    vacancyTitle         = "Estimating Manager II",
                    occupationCode       = "1112",
                    vacancySuburb        = "BENTLEIGH",
                    vacancyPostcode      = "3204",
                    stateCode            = "VIC",
                    vacancyDescription   = "Description goes here",
                    positionLimit        = 1,
                    workType             = "F",                     //full time
                    duration             = "N",                     //Contract
                    daysToExpiry         = 30,
                    howToApplyCode       = "PSD",                   // please see description
                    contactName          = "John Smith",
                    contactPhoneAreaCode = "03",
                    contactPhoneNumber   = "85089161",
                    vacancyType          = "H",                        // normal
                    returnMatchesFlag    = false,
                    yourReference        = string.Empty,
                }
            };

            var channel = _channelManager.Create();

            try
            {
                var addResponse = channel.AddVacancy(addRequest);

                if (addResponse.Header.executionStatus == EsiExecutionStatus.Failed)
                {
                    _channelManager.Close(channel);

                    var errorMessages = string.Empty;
                    foreach (var message in addResponse.Header.Messages)
                    {
                        errorMessages += "\r\n" + message.text;
                    }

                    Assert.Fail(string.Format("AddVacancy failed with messages : {0}", errorMessages));
                }

                new GetVacancyDetailsRequestMessage
                {
                    Security = new Services.External.JobSearch.Security {
                        UsernameToken = _usernameToken
                    },
                    Body = new GetVacancyDetailsRequestBody
                    {
                        vacancyID = addResponse.Body.vacancyID
                    }
                };

                var updateRequest = new UpdateVacancyRequestMessage
                {
                    Security = new Services.External.JobSearch.Security {
                        UsernameToken = _usernameToken
                    },
                    Body = new UpdateVacancyRequestBody
                    {
                        orgCode                              = OrgCode,
                        siteCode                             = SiteCode,
                        employerID                           = EmployerId,
                        vacancyID                            = addResponse.Body.vacancyID,
                        integrityControlNumber               = addResponse.Body.integrityControlNumber,
                        detailsIntegrityControlNumber        = addResponse.Body.detailsIntegrityControlNumber,
                        agentIntegrityControlNumber          = addResponse.Body.agentIntegrityControlNumber,
                        contactIntegrityControlNumber        = addResponse.Body.contactIntegrityControlNumber,
                        contactAddressIntegrityControlNumber = addResponse.Body.contactAddressIntegrityControlNumber,
                        vacancyTitle                         = "Estimating Manager II",
                        occupationCode                       = "1112",
                        vacancySuburb                        = "BENTLEIGH",
                        vacancyPostcode                      = "3204",
                        stateCode                            = "VIC",
                        vacancyDescription                   = "Updated description goes here",
                        positionLimit                        = 1,
                        workType                             = "F",        //full time
                        duration                             = "N",        //Contract
                        daysToExpiry                         = 30,
                        howToApplyCode                       = "PSD",      // please see description
                        contactName                          = "John Smith",
                        contactPhoneAreaCode                 = "03",
                        contactPhoneNumber                   = "85089161",
                        vacancyType                          = "H",           // normal
                        yourReference                        = string.Empty,
                    }
                };

                var updateResponse = channel.UpdateVacancy(updateRequest);

                DeleteVacancy(addResponse.Body.vacancyID, updateResponse.Body.integrityControlNumber);

                if (updateResponse.Header.executionStatus == EsiExecutionStatus.Failed)
                {
                    _channelManager.Close(channel);

                    var errorMessages = string.Empty;
                    foreach (var message in updateResponse.Header.Messages)
                    {
                        errorMessages += "\r\n" + message.text;
                    }

                    Assert.Fail(string.Format("UpdateVacancy failed with messages : {0}", errorMessages));
                }
            }
            catch (Exception)
            {
                _channelManager.Abort(channel);
                throw;
            }

            _channelManager.Close(channel);
        }