Exemple #1
0
        public void InsertPatient_MissingCondition()
        {
            var patient = new Patient
            {
                Name = "Joakim"
            };

            _context.Add(patient);
            Assert.Throws <DbUpdateException>(() => _context.SaveChanges());
        }
        private void ImportRooms(JsonDataFileImporterReader importer)
        {
            var rooms = importer.Rooms(_filePath);

            foreach (var room in rooms)
            {
                var r = new TreatmentRoom
                {
                    Name = room.Name,
                    TreatmentMachineId = room.TreatmentMachine
                };
                _context.Add(r);
            }
            _context.SaveChanges();
        }
        public void InsertConsultation()
        {
            var patient      = _context.Set <Patient>().First();
            var consultation = new Consultation
            {
                ConsultationDate = DateTime.UtcNow.Date,
                TreatmentRoomId  = "One",
                DoctorId         = 1,
                Patient          = patient
            };

            _context.Add(consultation);
            var affected = _context.SaveChanges();

            Assert.Equal(1, affected);
        }
Exemple #4
0
 public PatientFixture(DatabaseFixture database)
 {
     _database = database;
     _context  = _database.CreateContext;
     _context.Set <Patient>().RemoveRange(_context.Set <Patient>());
     _context.SaveChanges();
 }
 public ConsultationFixture(DatabaseFixture database)
 {
     _database = database;
     _context  = database.CreateContext;
     // Clear all prior each test
     _context.Set <Consultation>().RemoveRange(_context.Set <Consultation>());
     _context.SaveChanges();
 }