Beispiel #1
0
        public UnitOfWork(ApplicationDbContext context)
        {
            _context = context;

            Coops             = new CoopRepository(_context);
            Attendances       = new AttendanceRepository(_context);
            Games             = new GameRepository(_context);
            Followings        = new FollowingRepository(_context);
            Users             = new ApplicationUserRepository(_context);
            Notifications     = new NotificationRepository(_context);
            UserNotifications = new UserNotificationRepository(_context);
        }
Beispiel #2
0
        public void MyTestInitialize()
        {
            // Create mock db sets
            _mockCoops       = new Mock <DbSet <Coop> >();
            _mockAttendances = new Mock <DbSet <Attendance> >();

            // Create mock db context & pass to repository
            var mockContext = new Mock <IApplicationDbContext>();

            mockContext.SetupGet(c => c.Coops).Returns(_mockCoops.Object);             // setup mock context to return the mock db set
            mockContext.SetupGet(c => c.Attendances).Returns(_mockAttendances.Object); // setup mock context to return the mockAttendances db set

            _repository = new CoopRepository(mockContext.Object);
        }