예제 #1
0
        public static HistoricalVisit AddVisitToDatabase(HistoricalDataContext socialCareContext, HistoricalWorker?worker = null)
        {
            var visitInformation = HistoricalTestHelper.CreateDatabaseVisit(worker: worker);

            socialCareContext.HistoricalVisits.Add(visitInformation);
            socialCareContext.SaveChanges();

            return(visitInformation);
        }
예제 #2
0
        private HistoricalVisit AddVisitToDatabase(long?visitId = null, long?workerId = null)
        {
            var visit = HistoricalTestHelper.CreateDatabaseVisit(visitId, workerId: workerId);

            HistoricalSocialCareContext.HistoricalVisits.Add(visit);
            HistoricalSocialCareContext.HistoricalWorkers.Add(visit.Worker);
            HistoricalSocialCareContext.SaveChanges();

            return(visit);
        }
예제 #3
0
        public void CanConvertHistoricalVisitToVisitWhenCompletedFlagIsNullAndSetsTheFlagToFalse()
        {
            var historicalVisit = HistoricalTestHelper.CreateDatabaseVisit();

            historicalVisit.CompletedFlag = null;

            var visit = historicalVisit.ToDomain();

            visit.CompletedFlag.Should().BeFalse();
        }
예제 #4
0
        public void CanConvertHistoricalVisitToVisitWhenAssociatedWorkerIsNull()
        {
            var historicalVisit = HistoricalTestHelper.CreateDatabaseVisit();

            historicalVisit.Worker = null;

            var visit = historicalVisit.ToDomain();

            visit.CreatedByEmail.Should().BeNull();
            visit.CreatedByName.Should().BeNull();
        }
예제 #5
0
        public void CanConvertHistoricalVisitToVisit()
        {
            var historicalVisit = HistoricalTestHelper.CreateDatabaseVisit();

            var visit = historicalVisit.ToDomain();

            visit.Should().BeEquivalentTo(new Visit()
            {
                ActualDateTime     = visit.ActualDateTime,
                SeenAloneFlag      = visit.SeenAloneFlag,
                CompletedFlag      = visit.CompletedFlag,
                CreatedByEmail     = visit.CreatedByEmail,
                CreatedByName      = visit.CreatedByName,
                PersonId           = visit.PersonId,
                PlannedDateTime    = visit.PlannedDateTime,
                ReasonNotPlanned   = visit.ReasonNotPlanned,
                ReasonVisitNotMade = visit.ReasonVisitNotMade,
                VisitId            = visit.VisitId,
                VisitType          = visit.VisitType
            });
        }