コード例 #1
0
        public void SetUp()
        {
            MapperDependencyResolver.Resolve();
            context = new DrugstoreDbContext(options);
            #region Data seed
            var stockMed = new MedicineOnStock
            {
                MedicineCategory = MedicineCategory.Special,
                PricePerOne      = 30,
                Quantity         = 50,
                Refundation      = 0.20,
                Name             = "Lek testowy"
            };
            var doctor = new Doctor
            {
                FirstName  = "Testowy",
                SecondName = "Lekarz"
            };
            var patient = new Patient
            {
                FirstName  = "Testowy",
                SecondName = "Pacjent"
            };

            context.Doctors.Add(doctor);

            context.Patients.Add(patient);

            context.Medicines.Add(stockMed);

            context.SaveChanges();
            #endregion
        }
コード例 #2
0
        public void SetUp()
        {
            MapperDependencyResolver.Resolve();
            context = new DrugstoreDbContext(options);
            #region Data seed
            var stockMed = new MedicineOnStock
            {
                MedicineCategory = MedicineCategory.Special,
                PricePerOne      = 30,
                Quantity         = 50,
                Refundation      = 0.20,
                Name             = "Lek testowy"
            };
            var doctor = new Doctor
            {
                FirstName  = "Testowy",
                SecondName = "Lekarz"
            };
            var patient = new Patient
            {
                FirstName  = "Testowy",
                SecondName = "Pacjent"
            };
            var prescription = new MedicalPrescription
            {
                CreationTime      = DateTime.Now,
                Doctor            = doctor,
                Patient           = patient,
                VerificationState = VerificationState.NotVerified,
                Medicines         = new List <AssignedMedicine> {
                    new AssignedMedicine {
                        StockMedicine    = stockMed,
                        PricePerOne      = stockMed.PricePerOne * (1 - stockMed.Refundation),
                        AssignedQuantity = 10
                    }
                }
            };

            context.Doctors.Add(doctor);

            context.Patients.Add(patient);

            context.Medicines.Add(stockMed);

            context.MedicalPrescriptions.Add(prescription);
            context.SaveChanges();
            #endregion
        }
コード例 #3
0
        public void SetUp()
        {
            MapperDependencyResolver.Resolve();
            context = new DrugstoreDbContext(options);
            #region Data seed
            var stockMedOne = new MedicineOnStock
            {
                MedicineCategory = MedicineCategory.Special,
                PricePerOne      = 30,
                Quantity         = 50,
                Refundation      = 0.20,
                Name             = "Lek testowy"
            };
            var stockMedTwo = new MedicineOnStock
            {
                MedicineCategory = MedicineCategory.Normal,
                PricePerOne      = 20,
                Quantity         = 100,
                Refundation      = 0.60,
                Name             = "Voltaren"
            };

            var doctor = new Doctor
            {
                FirstName  = "Testowy",
                SecondName = "Lekarz"
            };

            var patientOne = new Patient
            {
                FirstName  = "Pacjentka",
                SecondName = "One"
            };

            var patientTwo = new Patient
            {
                FirstName  = "Pacjent",
                SecondName = "Two"
            };
            var prescriptions = new MedicalPrescription []
            {
                new MedicalPrescription {
                    CreationTime      = DateTime.Parse("2019/01/20"),
                    Doctor            = doctor,
                    Patient           = patientOne,
                    VerificationState = VerificationState.NotVerified,
                    Medicines         = new List <AssignedMedicine> {
                        new AssignedMedicine {
                            StockMedicine    = stockMedOne,
                            PricePerOne      = stockMedOne.PricePerOne * (1 - stockMedOne.Refundation),
                            AssignedQuantity = 10
                        }
                    }
                },
                new MedicalPrescription
                {
                    CreationTime      = DateTime.Parse("2019/01/22"),
                    Doctor            = doctor,
                    Patient           = patientOne,
                    VerificationState = VerificationState.NotVerified,
                    Medicines         = new List <AssignedMedicine> {
                        new AssignedMedicine {
                            StockMedicine    = stockMedTwo,
                            PricePerOne      = stockMedTwo.PricePerOne * (1 - stockMedTwo.Refundation),
                            AssignedQuantity = 10
                        }
                    }
                },

                new MedicalPrescription
                {
                    CreationTime      = DateTime.Parse("2019/01/28"),
                    Doctor            = doctor,
                    Patient           = patientTwo,
                    VerificationState = VerificationState.Accepted,
                    Medicines         = new List <AssignedMedicine> {
                        new AssignedMedicine {
                            StockMedicine    = stockMedOne,
                            PricePerOne      = stockMedOne.PricePerOne * (1 - stockMedOne.Refundation),
                            AssignedQuantity = 10
                        }
                    }
                },
                new MedicalPrescription
                {
                    CreationTime      = DateTime.Parse("2019/01/30"),
                    Doctor            = doctor,
                    Patient           = patientTwo,
                    VerificationState = VerificationState.Accepted,
                    Medicines         = new List <AssignedMedicine> {
                        new AssignedMedicine {
                            StockMedicine    = stockMedTwo,
                            PricePerOne      = stockMedTwo.PricePerOne * (1 - stockMedTwo.Refundation),
                            AssignedQuantity = 10
                        }
                    }
                }
            };

            context.Doctors.Add(doctor);

            context.Patients.Add(patientTwo);

            context.Medicines.Add(stockMedOne);
            context.Medicines.Add(stockMedTwo);

            context.MedicalPrescriptions.AddRange(prescriptions);

            context.SaveChanges();
            #endregion
        }