public void WorkOrderResponseMaps()
        {
            var workOrder = new Helpers.StubGeneration.Generator <WorkOrder>()
                            .AddDefaultGenerators()
                            .Generate();

            AppointmentDetails appointment = new AppointmentDetails
            {
                Date        = DateTime.UtcNow,
                Description = "test",
                End         = DateTime.UtcNow,
                Start       = DateTime.UtcNow
            };
            var response = workOrder.ToResponse(appointment, new Uri("https://managementAddress.none"), canAssignOperative: false);

            PropertyClass propertyClass = workOrder.Site?.PropertyClass.FirstOrDefault();
            string        addressLine   = propertyClass?.Address?.AddressLine;

            response.CallerNumber.Should().Be(workOrder.Customer.Person.Communication.Where(cc => cc.Channel.Medium == RepairsApi.V2.Generated.CommunicationMediumCode._20).FirstOrDefault()?.Value);
            response.CallerName.Should().Be(workOrder.Customer.Person.Name.Full);
            response.DateRaised.Should().Be(workOrder.DateRaised);
            response.Description.Should().Be(workOrder.DescriptionOfWork);
            response.Owner.Should().Be(workOrder.AssignedToPrimary.Name);
            response.Priority.Should().Be(workOrder.WorkPriority.PriorityDescription);
            response.PriorityCode.Should().Be(workOrder.WorkPriority.PriorityCode);
            response.Property.Should().Be(addressLine);
            response.PropertyReference.Should().Be(workOrder.Site?.PropertyClass.FirstOrDefault()?.PropertyReference);
            response.Reference.Should().Be(workOrder.Id);
            response.Target.Should().Be(workOrder.WorkPriority.RequiredCompletionDateTime);
            response.Property.Should().Be(addressLine);
            response.ExternalAppointmentManagementUrl.ToString().Should().Contain(workOrder.ExternalSchedulerReference);
            response.CanAssignOperative.Should().BeFalse();
            response.PlannerComments.Should().Be(workOrder.PlannerComments);
        }
        public void DoesNotSetExternalAppointmentManagementUrlWhenNotDrs()
        {
            var workOrder = new Helpers.StubGeneration.Generator <WorkOrder>()
                            .AddDefaultGenerators()
                            .Generate();

            workOrder.ExternalSchedulerReference = null;

            AppointmentDetails appointment = new AppointmentDetails
            {
                Date        = DateTime.UtcNow,
                Description = "test",
                End         = DateTime.UtcNow,
                Start       = DateTime.UtcNow
            };
            var response = workOrder.ToResponse(appointment, new Uri("https://managementAddress.none"), false);

            response.ExternalAppointmentManagementUrl.Should().BeNull();
        }