Esempio n. 1
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);
        }
        public void WhenNoteTypeCannotBeFoundReturnsNullForNoteType()
        {
            var nonexistentNoteType = HistoricalTestHelper.CreateDatabaseNoteType("NONEXISTENT", "Non existent Case Note Type");
            var worker   = HistoricalTestHelper.CreateDatabaseWorker();
            var caseNote = HistoricalTestHelper.CreateDatabaseCaseNote(includeNoteType: false);

            HistoricalSocialCareContext.HistoricalNoteTypes.Add(nonexistentNoteType);
            HistoricalSocialCareContext.HistoricalWorkers.Add(worker);
            HistoricalSocialCareContext.HistoricalCaseNotes.Add(caseNote);
            HistoricalSocialCareContext.SaveChanges();

            var response = _historicalDataGateway.GetCaseNoteById(caseNote.Id);

            response?.NoteType.Should().BeNull();
        }
        private HistoricalCaseNote AddCaseNoteWithNoteTypeAndWorkerToDatabase(string workerFirstName         = null, string workerLastName = null,
                                                                              string workerEmailAddress      = null, long id               = 123, long personId = 123, string caseNoteType = "CASSUMASC",
                                                                              string caseNoteTypeDescription = "Case Summary (ASC)")
        {
            var noteType = HistoricalTestHelper.CreateDatabaseNoteType(caseNoteType, caseNoteTypeDescription);
            var worker   = HistoricalTestHelper.CreateDatabaseWorker(workerFirstName, workerLastName, workerEmailAddress);
            var caseNote = HistoricalTestHelper.CreateDatabaseCaseNote(id, personId, worker, noteType);

            HistoricalSocialCareContext.HistoricalNoteTypes.Add(noteType);
            HistoricalSocialCareContext.HistoricalWorkers.Add(worker);
            HistoricalSocialCareContext.HistoricalCaseNotes.Add(caseNote);
            HistoricalSocialCareContext.SaveChanges();

            return(caseNote);
        }
Esempio n. 4
0
        private (HistoricalCaseNote, HistoricalNoteType, HistoricalWorker) AddCaseNoteWithNoteTypeAndWorkerToDatabase(long personId, long caseNoteId = 123)
        {
            var caseNoteType            = _faker.Random.String2(5);
            var caseNoteTypeDescription = _faker.Random.String2(15);

            var noteType = HistoricalTestHelper.CreateDatabaseNoteType(caseNoteType, caseNoteTypeDescription);

            HistoricalSocialCareContext.HistoricalNoteTypes.Add(noteType);

            var worker = HistoricalTestHelper.CreateDatabaseWorker();

            HistoricalSocialCareContext.HistoricalWorkers.Add(worker);

            var caseNote = HistoricalTestHelper.CreateDatabaseCaseNote(caseNoteId, personId, worker, noteType);

            HistoricalSocialCareContext.HistoricalCaseNotes.Add(caseNote);

            HistoricalSocialCareContext.SaveChanges();

            return(caseNote, noteType, worker);
        }