Esempio n. 1
0
 public DoctorService(PMDbContext context)
 {
     _context = context;
 }
 public UserController(PMDbContext context, UserService userService)
 {
     _context     = context;
     _userService = userService;
 }
 public CourseHistoryService(PMDbContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public PatientController(PMDbContext context, PatientService patientService)
 {
     _context        = context;
     _patientService = patientService;
 }
 public CourseService(PMDbContext context)
 {
     _context = context;
 }
 public MedicineService(PMDbContext context)
 {
     _context = context;
 }
 public UserService(PMDbContext context)
 {
     _context = context;
 }
Esempio n. 8
0
 public TasksRepository(PMDbContext context) : base(context)
 {
 }
Esempio n. 9
0
 public AccountController(PMDbContext context, AccountService accountService)
 {
     _context        = context;
     _accountService = accountService;
 }
 public ProjectsRepository(PMDbContext context) : base(context)
 {
 }
 public MedicineController(PMDbContext context, MedicineService medicineService)
 {
     _context         = context;
     _medicineService = medicineService;
 }
 public UserRepository(PMDbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 13
0
 public AccountService(PMDbContext context)
 {
     _context = context;
 }
Esempio n. 14
0
 public PatientService(PMDbContext context)
 {
     _context = context;
 }
 public GenericRepository(PMDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Esempio n. 16
0
 public TreatmentService(PMDbContext context)
 {
     _context = context;
 }
Esempio n. 17
0
 public CourseHistoryController(PMDbContext context, CourseHistoryService couseHistoryService)
 {
     _context             = context;
     _couseHistoryService = couseHistoryService;
 }
Esempio n. 18
0
        public virtual PMDbContext InitializeContext()
        {
            //var builder = new DbContextOptionsBuilder<TestDbContext>().UseInMemoryDatabase("TestPMDb");
            //var cxt = new TestDbContext(builder.Options);

            if (mockContext == null)
            {
                //var mockUserSet = new Mock<DbSet<User>>();
                //var testUsers = Enumerable.Range(1, 10)
                //                .Select(counter => new User
                //                {
                //                    Id = Guid.NewGuid(),
                //                    UserId = $"TestUser{counter}",
                //                    Created = DateTime.Today,
                //                    FirstName = $"User{counter}FirstName",
                //                    LastName = $"User{counter}LastName"
                //                }).AsQueryable();
                //cxt.MockUsers.As<IQueryable<User>>().Setup(u => u.Provider).Returns(testUsers.Provider);
                //cxt.MockUsers.As<IQueryable<User>>().Setup(u => u.Expression).Returns(testUsers.Expression);
                //cxt.MockUsers.As<IQueryable<User>>().Setup(u => u.ElementType).Returns(testUsers.ElementType);
                //cxt.MockUsers.As<IQueryable<User>>().Setup(u => u.GetEnumerator()).Returns(testUsers.GetEnumerator());
                //mockUserSet.As<IQueryable<User>>().Setup(u => u.Provider).Returns(testUsers.Provider);
                //mockUserSet.As<IQueryable<User>>().Setup(u => u.Expression).Returns(testUsers.Expression);
                //mockUserSet.As<IQueryable<User>>().Setup(u => u.ElementType).Returns(testUsers.ElementType);
                //mockUserSet.As<IQueryable<User>>().Setup(u => u.GetEnumerator()).Returns(testUsers.GetEnumerator());

                //var mockProjectSet = new Mock<DbSet<Project>>();
                //var testProjects = Enumerable.Range(1, 10)
                //                .Select(counter => new Project
                //                {
                //                    ProjectId = counter,
                //                    ManagerId = Guid.NewGuid(),
                //                    ProjectStart = DateTime.Today,
                //                    ProjectName = $"TestProject{counter}",
                //                    Priority = counter
                //                }).AsQueryable();
                //cxt.MockProjects.As<IQueryable<Project>>().Setup(u => u.Provider).Returns(testProjects.Provider);
                //cxt.MockProjects.As<IQueryable<Project>>().Setup(u => u.Expression).Returns(testProjects.Expression);
                //cxt.MockProjects.As<IQueryable<Project>>().Setup(u => u.ElementType).Returns(testProjects.ElementType);
                //cxt.MockProjects.As<IQueryable<Project>>().Setup(u => u.GetEnumerator()).Returns(testProjects.GetEnumerator());
                //mockProjectSet.As<IQueryable<Project>>().Setup(u => u.Provider).Returns(testProjects.Provider);
                //mockProjectSet.As<IQueryable<Project>>().Setup(u => u.Expression).Returns(testProjects.Expression);
                //mockProjectSet.As<IQueryable<Project>>().Setup(u => u.ElementType).Returns(testProjects.ElementType);
                //mockProjectSet.As<IQueryable<Project>>().Setup(u => u.GetEnumerator()).Returns(testProjects.GetEnumerator());

                //var mockTaskSet = new Mock<DbSet<Task>>();
                //var testTasks = Enumerable.Range(1, 10)
                //                .Select(counter => new Task
                //                {
                //                    TaskId = counter,
                //                    ParentTaskId = (counter % 2) * 2,
                //                    ProjectId = counter,
                //                    TaskOwnerId = Guid.NewGuid(),
                //                    StartDate = DateTime.Today,
                //                    TaskName = $"TestTask{counter}",
                //                    Priority = counter
                //                }).AsQueryable();
                //mockTaskSet.As<IQueryable<Task>>().Setup(u => u.Provider).Returns(testTasks.Provider);
                //mockTaskSet.As<IQueryable<Task>>().Setup(u => u.Expression).Returns(testTasks.Expression);
                //mockTaskSet.As<IQueryable<Task>>().Setup(u => u.ElementType).Returns(testTasks.ElementType);
                //mockTaskSet.As<IQueryable<Task>>().Setup(u => u.GetEnumerator()).Returns(testTasks.GetEnumerator());

                var builder = new DbContextOptionsBuilder <PMDbContext>().UseInMemoryDatabase("TestPMDb");
                //mockContext = new Mock<PMDbContext>(builder.Options);
                mockContext = new PMDbContext(builder.Options);
                //mockContext.Users.AddRange(testUsers); //mockUserSet.Object;
                //mockContext.Projects.AddRange(testProjects); //mockProjectSet.Object;
                //mockContext.Tasks.AddRange(testTasks); //mockTaskSet.Object;
                //mockContext.SaveChanges(true);
                //mockContext.Setup(u => u.Users).Returns(mockUserSet.Object);
                //mockContext.Setup(p => p.Projects).Returns(mockProjectSet.Object);
                //mockContext.Setup(t => t.Tasks).Returns(mockTaskSet.Object);
            }
            return(mockContext);
        }
 public TreatmentController(PMDbContext context)
 {
     _context = context;
 }
Esempio n. 20
0
 public ProjectRepo(PMDbContext dbContext) : base(dbContext)
 {
 }
 //private readonly PMDbContext _usersDbContext;
 public UsersRepository(PMDbContext context) : base(dbContext: context)
 {
     // _usersDbContext = context;
 }