Exemplo n.º 1
0
        public static SearchHospitalsResponse ToSearchHospitalsResponse(this HospitalsResponse source)
        {
            if (source == null || source._embedded == null)
            {
                return(null);
            }

            var response = new SearchHospitalsResponse
            {
                Data = source._embedded.Hospitals.ToHospitalDetailsList()
            };

            return(response.PopulatePageDetails(source.Page));
        }
Exemplo n.º 2
0
        public async void FindHelp_Should_Return_Correctly()
        {
            var hospitalId = 111;
            var painLevel  = 1;
            var response   = new SearchHospitalsResponse
            {
                CurrentPageIndex = 123,
                NextPageIndex    = 456,
                PrevPageIndex    = 789,
                Data             = new []
                {
                    new HospitalDetails
                    {
                        Id    = hospitalId,
                        Queue = new []
                        {
                            new QueueDetails {
                                PainLevel = painLevel
                            }
                        }
                    }
                }
            };

            _hospitalRepository.SearchHospitals(Arg.Any <SearchHospitalsRequest>()).Returns(response);

            var request = new FindHelpRequest {
                SeverityLevel = painLevel
            };
            var actual = await _service.FindHelp(request);

            actual.PrevPageIndex.Should().Be(null);
            actual.NextPageIndex.Should().Be(null);
            actual.Data.Should().HaveCount(1);
            actual.Data.First().Id.Should().Be(hospitalId);
        }