Ejemplo n.º 1
0
        public UserControllerTests()
        {
            var _config = new ConfigurationBuilder().AddUserSecrets <UserControllerTests>().Build();

            var _logger = new Mock <ILogger <UsersController> >();

            _userSecretSetting = new UserSecretSetting()
            {
                EncryptionKey      = _config["EncryptionKey"],
                GoogleClientId     = _config["Authentication:Google:ClientId"],
                GoogleClientSecret = _config["Authentication:Google:ClientSecret"]
            };
            var userSettingOption  = Options.Create(_userSecretSetting);
            var userRepositoryMock = new Mock <IUserRepository>();
            var builder            = new ConfigurationBuilder().AddUserSecrets <UserControllerTests>();
            var options            = Options.Create(new LocalizationOptions {
                ResourcesPath = "Resources"
            });
            var factory = new ResourceManagerStringLocalizerFactory(options, NullLoggerFactory.Instance);

            _localizer = new StringLocalizer <UsersController>(factory);
            var usersDbOptions = new DbContextOptionsBuilder <UserContext>().UseInMemoryDatabase(databaseName: "GmailPOC").Options;

            _userContext = new UserContext(usersDbOptions);
            TestHelper.AddDummyEventData(_userContext);
            TestHelper.AddDummyEventAttendee(_userContext);
            TestHelper.AddDummyRecurringEvent(_userContext);
            _userRepository = new UserRepository(_userContext);
            _userService    = new UserService(_userServiceLogger, _userRepository);
            _userController = new UsersController(_userService, _logger.Object, userSettingOption, _localizer);
        }
Ejemplo n.º 2
0
        public UserRepositoryTests()
        {
            var userDbOptions = new DbContextOptionsBuilder <UserContext>()
                                .UseInMemoryDatabase(databaseName: "GmailPOC")
                                .Options;

            _context = new UserContext(userDbOptions);
            TestHelper.AddDummyEventData(_context);
            TestHelper.AddDummyEventAttendee(_context);
            TestHelper.AddDummyRecurringEvent(_context);
            _userRepository = new UserRepository(_context);
        }