Example #1
0
        public UnitTest1()
        {
            var options = new DbContextOptionsBuilder <chdbContext>().UseInMemoryDatabase(databaseName: "Medication_tests").Options;

            context = new chdbContext(options);


            // Use the in memory data added here to be used for testing. Should not ever test directly on the database.
            context.Medications.AddRange(
                new Medication
            {
                MedicationId          = 1,
                MedicationDescription = "Pain Reliever",
                MedicationCost        = 1.0M
            },
                new Medication
            {
                MedicationId          = 2,
                MedicationDescription = "Ibuprofen",
                MedicationCost        = 1.23M
            },
                new Medication
            {
                MedicationId          = 3,
                MedicationDescription = "Advil",
                MedicationCost        = 1.47M
            }
                );

            context.SaveChanges();
        }
 public PhysiciansController(chdbContext context)
 {
     _context = context;
 }
 public MedicationsController(chdbContext context)
 {
     _context = context;
 }