예제 #1
0
        public UserTests()
        {
            var existingUser = Builders.GetUserDefault();

            var dbOptions = new DbContextOptionsBuilder <DataContext>()
                            .UseInMemoryDatabase(databaseName: "tmainternship")
                            .Options;

            _memContext  = new DataContext(dbOptions);
            _memUserRepo = new UserRepository(_memContext);

            var mockUserRepo = new Mock <IUserRepository>();

            mockUserRepo.Setup(o => o.GetOne(existingUser.UserId))
            .Returns(existingUser);

            mockUserRepo.Setup(o => o.UserDelete(existingUser.UserId))
            .Returns(true);

            // Complete the setup of our Mock Product Repository
            _mockUserRepo = mockUserRepo.Object;
        }