/// <summary> /// Creates a <see cref="UnitOfWork"/> instance. /// </summary> /// <returns>A new object each time.</returns> public IUnitOfWork CreateMockUnitOfWork() { StudVoiceDBContext transITDBContext = new StudVoiceDBContext( new DbContextOptionsBuilder <StudVoiceDBContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .EnableSensitiveDataLogging() .Options ); IUserStore <User> userStore = new UserStore(transITDBContext); IRoleStore <Role> roleStore = new RoleStore(transITDBContext); var serviceProvider = new Mock <IServiceProvider>(); serviceProvider.Setup(x => x.GetService(typeof(RoleManager <Role>))).Returns(MockHelpers.TestRoleManager(roleStore)); serviceProvider.Setup(x => x.GetService(typeof(UserManager <User>))).Returns(MockHelpers.TestUserManager(userStore)); var unitOfWork = new UnitOfWork(transITDBContext, serviceProvider.Object); unitOfWork.RoleManager.CreateAsync(new Role { Name = "STUDENT" }).Wait(); unitOfWork.RoleManager.CreateAsync(new Role { Name = "TEACHER" }).Wait(); return(unitOfWork); }
public ContactRepository(StudVoiceDBContext context) : base(context) { }
public TeacherRepository(StudVoiceDBContext context) : base(context) { }
public LessonRepository(StudVoiceDBContext context) : base(context) { }
public UserRepository(StudVoiceDBContext dbContext) { _dbContext = dbContext; }
public BaseRepository(StudVoiceDBContext context) { _entities = context.Set <TEntity>(); _context = context; }
public UnitOfWork(StudVoiceDBContext context, IServiceProvider serviceProvider) { _context = context; _serviceProvider = serviceProvider; }
public FacultyRepository(StudVoiceDBContext context) : base(context) { }
public RoleStore(StudVoiceDBContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }