Exemple #1
0
        public async Task <string> ProcessService(string serviceId, TextWriter log)
        {
            var service  = _unitOfWork.Services.GetServiceById(serviceId);
            var endpoint = EndPointHelper.GetEndPointForService(service);

            var url = ConfigHelper.GetBaldrApiUrl() + endpoint;

            log.WriteLine($"url: {url}");

            var jsonData = ServiceToJson.GetJsonDataForService(service);

            log.WriteLine($"jsonData {jsonData}");

            var request = RequestHelper.CreateBaldrRequest(ConfigHelper.GetSeApiToken(), url, jsonData);

            using (var client = new HttpClient())
            {
                var response = await client.SendAsync(request);

                var content = await response.Content.ReadAsStringAsync();

                log.WriteLine($"response code {response.IsSuccessStatusCode} : {response.StatusCode}");
                if (!response.IsSuccessStatusCode)
                {
                    throw new SimImportException(content);
                }
                return(content);
            }
        }
Exemple #2
0
        public void GetEndPointForService_ProgramNameDoesNotContainBundledAndCategoryIsSettlingIn_ShouldReturnSettlingIn()
        {
            _service.ServiceType.Category = ServiceCategory.SettlingIn;

            var endpoint = EndPointHelper.GetEndPointForService(_service);

            endpoint.Should().Be(EndPointHelper.SettlingInEndpoint);
        }
Exemple #3
0
        public void GetEndPointForService_CategoryIsWelcomePacket_SHouldReturnFirstContact()
        {
            _service.ServiceType.Category = ServiceCategory.WelcomePacket;

            var endpoint = EndPointHelper.GetEndPointForService(_service);

            endpoint.Should().Be(EndPointHelper.FirstContactEndPoint);
        }
Exemple #4
0
        public void GetEndPointForService_CategoryIsInitialConsultation_ShouldReturnFirstContact()
        {
            _service.ServiceType.Category = ServiceCategory.InitialConsultation;

            var endpoint = EndPointHelper.GetEndPointForService(_service);

            endpoint.Should().Be(EndPointHelper.FirstContactEndPoint);
        }
Exemple #5
0
        public void GetEndPointForService_ProgramNameContainsBundledAndCategoryIsSettlingIn_ShouldReturnDestinationChecklist()
        {
            _service.ServiceType.Category = ServiceCategory.SettlingIn;
            _service.Order.ProgramName    = "Test Bundled Program";

            var endpoint = EndPointHelper.GetEndPointForService(_service);

            endpoint.Should().Be(EndPointHelper.DestinationChecklistEndPoint);
        }