public async Task CanGetReferralHtmlPages(Gov.Jag.Embc.Public.ViewModels.Referral referral)
        {
            var pdfService = new PdfConverter();
            var service    = new ReferralsService(di, pdfService, cus, null);

            var fromCommunity = await GetRandomSeededCommunity();

            var taskId = await SeedIncident(fromCommunity.Id);

            var regVM = RegistrationGenerator.GenerateSelf();

            regVM.IncidentTask = new Gov.Jag.Embc.Public.ViewModels.IncidentTask {
                Id = taskId
            };

            var registrationId = await di.CreateEvacueeRegistrationAsync(regVM);

            referral.EssNumber = registrationId;

            var referralIds = new List <string>();
            var id          = await di.CreateReferralAsync(referral);

            referralIds.Add(id);

            var printReferrals = new ReferralsToPrint {
                ReferralIds = referralIds, AddSummary = true
            };

            var content = await service.GetReferralHtmlPagesAsync(printReferrals);

            Assert.False(string.IsNullOrEmpty(content));
        }
        public async Task CanGetReferralHtmlPages(Gov.Jag.Embc.Public.ViewModels.Referral referral)
        {
            var ctx        = EmbcDb;
            var di         = new DataInterface(ctx, Mapper);
            var pdfService = new PdfConverter();
            var service    = new ReferralsService(di, pdfService);

            var incidentTask = await di.CreateIncidentTaskAsync(IncidentTaskGenerator.Generate());

            var regVM = RegistrationGenerator.GenerateSelf();

            regVM.IncidentTask = incidentTask;

            var registrationId = await di.CreateEvacueeRegistrationAsync(regVM);

            referral.EssNumber = registrationId;

            var referralIds = new List <string>();
            var id          = await di.CreateReferralAsync(referral);

            referralIds.Add(id);

            var printReferrals = new ReferralsToPrint {
                ReferralIds = referralIds, AddSummary = true
            };

            var content = await service.GetReferralHtmlPagesAsync(printReferrals);

            Assert.False(string.IsNullOrEmpty(content));
        }
        public async Task CanMapToPrintReferrals(Gov.Jag.Embc.Public.ViewModels.Referral referral)
        {
            var pdfService = new PdfConverter();
            var service    = new ReferralsService(di, pdfService, cus, null);

            var fromCommunity = await GetRandomSeededCommunity();

            var taskId = await SeedIncident(fromCommunity.Id);

            var regVM = RegistrationGenerator.GenerateSelf();

            regVM.IncidentTask = new Gov.Jag.Embc.Public.ViewModels.IncidentTask {
                Id = taskId
            };

            var registrationId = await di.CreateEvacueeRegistrationAsync(regVM);

            referral.EssNumber = registrationId;

            var referralId = await di.CreateReferralAsync(referral);

            var id = await di.CreateReferralAsync(referral);

            var result = await di.GetReferralsAsync(new string[] { id });

            Assert.NotNull(result);
            Assert.Equal("D0000001", result.First().IncidentTaskNumber);
            Assert.NotNull(result);
            Assert.Equal(referral.EssNumber, result.First().EssNumber);
            Assert.NotEmpty(result.First().Id);
            Assert.Equal(referral.Type + (referral.SubType != null ? $"_{referral.SubType}" : ""), result.First().Type);
            Assert.Null(result.First().SubType);
            Assert.Equal(referral.Purchaser, result.First().Purchaser);
            Assert.Equal(referral.TotalAmount, result.First().TotalAmount);
            Assert.Equal(referral.Supplier.Fax, result.First().Supplier.Fax);
            Assert.Equal(referral.ValidDates.From, result.First().ValidDates.From);
            Assert.Equal(referral.ValidDates.To, result.First().ValidDates.To);
            Assert.Equal(referral.ConfirmChecked, result.First().ConfirmChecked);
            Assert.All(result.First().Evacuees, e => referral.Evacuees.Any(re => re.Id == e.Id));
            Assert.Equal(referral.Evacuees.Count(), result.First().Evacuees.Count());
            Assert.NotNull(result.First().Supplier);
            Assert.Equal(referral.Supplier.Name, result.First().Supplier.Name);
            Assert.Equal(referral.Supplier.Address, result.First().Supplier.Address);
            Assert.Equal(referral.Supplier.City, result.First().Supplier.City);
            Assert.Equal(referral.Supplier.Province, result.First().Supplier.Province);
            Assert.Equal(referral.Supplier.Fax, result.First().Supplier.Fax);
            Assert.Equal(referral.Supplier.Telephone, result.First().Supplier.Telephone);
            Assert.Equal(referral.Supplier.Active, result.First().Supplier.Active);
            Assert.Equal(referral.ToAddress, result.First().ToAddress);
            Assert.Equal(referral.FromAddress, result.First().FromAddress);
            Assert.Equal(referral.OtherTransportModeDetails, result.First().OtherTransportModeDetails);
            Assert.Equal(referral.NumLunches, result.First().NumLunches);
            Assert.Equal(referral.NumBreakfasts, result.First().NumBreakfasts);
            Assert.Equal(referral.NumDaysMeals, result.First().NumDaysMeals);
            Assert.Equal(referral.NumDinners, result.First().NumDinners);
            Assert.Equal(referral.NumNights, result.First().NumNights);
            Assert.Equal(referral.ApprovedItems, result.First().ApprovedItems);
            Assert.Equal(referral.ExtremeWinterConditions, result.First().ExtremeWinterConditions);
        }