public void CanMapWarningNoteFromDatabaseEntityToDomainObject()
        {
            long number = _faker.Random.Number();
            var  dt     = DateTime.Now;
            var  text   = _faker.Random.String();

            var dbWarningNote = new dbWarningNote
            {
                Id        = number,
                PersonId  = number,
                StartDate = dt,
                EndDate   = dt,
                DisclosedWithIndividual = true,
                DisclosedDetails        = text,
                Notes                    = text,
                ReviewDate               = dt,
                NextReviewDate           = dt,
                NoteType                 = text,
                Status                   = text,
                DisclosedDate            = dt,
                DisclosedHow             = text,
                WarningNarrative         = text,
                ManagerName              = text,
                DiscussedWithManagerDate = dt,
                CreatedBy                = text
            };

            var expectedResponse = new WarningNote
            {
                Id        = number,
                PersonId  = number,
                StartDate = dt,
                EndDate   = dt,
                DisclosedWithIndividual = true,
                DisclosedDetails        = text,
                Notes                    = text,
                ReviewDate               = dt,
                NextReviewDate           = dt,
                NoteType                 = text,
                Status                   = text,
                DisclosedDate            = dt,
                DisclosedHow             = text,
                WarningNarrative         = text,
                ManagerName              = text,
                DiscussedWithManagerDate = dt,
                CreatedBy                = text,
                WarningNoteReviews       = new List <WarningNoteReview>()
            };

            var response = dbWarningNote.ToDomain();

            response.Should().BeOfType <WarningNote>();
            response.Should().BeEquivalentTo(expectedResponse);
        }
 public static WarningNoteResponse ToResponse(this WarningNote warningNote)
 {
     return(new WarningNoteResponse
     {
         Id = warningNote.Id,
         PersonId = warningNote.PersonId,
         StartDate = warningNote.StartDate?.ToString("s"),
         EndDate = warningNote.EndDate?.ToString("s"),
         DisclosedWithIndividual = warningNote.DisclosedWithIndividual,
         DisclosedDetails = warningNote.DisclosedDetails,
         Notes = warningNote.Notes,
         ReviewDate = warningNote.ReviewDate?.ToString("s"),
         NextReviewDate = warningNote.NextReviewDate?.ToString("s"),
         NoteType = warningNote.NoteType,
         Status = warningNote.Status,
         DisclosedDate = warningNote.DisclosedDate?.ToString("s"),
         DisclosedHow = warningNote.DisclosedHow,
         WarningNarrative = warningNote.WarningNarrative,
         ManagerName = warningNote.ManagerName,
         DiscussedWithManagerDate = warningNote.DiscussedWithManagerDate?.ToString("s"),
         CreatedBy = warningNote.CreatedBy,
         WarningNoteReviews = warningNote.WarningNoteReviews?.Select(x => x.ToResponse()).ToList()
     });
 }