示例#1
0
        public StuffRepositoryTest()
        {
            _connection = new SqliteConnection("DataSource=:memory:");
            _connection.Open();
            var options = new DbContextOptionsBuilder <StuffDbContext>()
                          .UseSqlite(_connection)
                          .Options;

            _context = new StuffDbContext(options);
            _context.Database.EnsureCreated();
            var mockAuth = Mock.Of <IUserAuthRepo>(x => x.GetCurrentUserAsync(It.IsAny <string>()) == Task.FromResult(_dbUser));

            _stuffRepo = new StuffRepo(_context, mockAuth);
        }
示例#2
0
 public StuffController(IStuffRepo stuffRepo)
 {
     _stuffRepo = stuffRepo;
 }