public static HistoricalVisit AddVisitToDatabase(HistoricalDataContext socialCareContext, HistoricalWorker?worker = null) { var visitInformation = HistoricalTestHelper.CreateDatabaseVisit(worker: worker); socialCareContext.HistoricalVisits.Add(visitInformation); socialCareContext.SaveChanges(); return(visitInformation); }
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); }
public void CanConvertHistoricalVisitToVisitWhenCompletedFlagIsNullAndSetsTheFlagToFalse() { var historicalVisit = HistoricalTestHelper.CreateDatabaseVisit(); historicalVisit.CompletedFlag = null; var visit = historicalVisit.ToDomain(); visit.CompletedFlag.Should().BeFalse(); }
public void CanConvertHistoricalVisitToVisitWhenAssociatedWorkerIsNull() { var historicalVisit = HistoricalTestHelper.CreateDatabaseVisit(); historicalVisit.Worker = null; var visit = historicalVisit.ToDomain(); visit.CreatedByEmail.Should().BeNull(); visit.CreatedByName.Should().BeNull(); }
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 }); }