コード例 #1
0
 public AccountHandler(ITenantRepository tenantRepository, IUserRepository repository,
                       ICreateAccountEmailService createAccountEmailService)
 {
     _tenantRepository          = tenantRepository;
     _repository                = repository;
     _createAccountEmailService = createAccountEmailService;
 }
コード例 #2
0
        public void SetUp()
        {
            Settings.SecurityKey = "cbffeba849124af8b7b89675c223fd3d";

            _tenants = new List <AppTenant>();
            _users   = new List <User>();
            _mockTenantRepository          = new Mock <ITenantRepository>();
            _mockUserRepository            = new Mock <IUserRepository>();
            _mockCreateAccountEmailService = new Mock <ICreateAccountEmailService>();

            _mockTenantRepository.Setup(mr => mr.Get(It.IsAny <string>())).Returns((string s) => _tenants.SingleOrDefault(x => x.AppName == s));

            _mockTenantRepository.Setup(mr => mr.Save(It.IsAny <AppTenant>())).Callback((AppTenant target) => { _tenants.Add(target); });

            _mockUserRepository.Setup(mr => mr.Get(It.IsAny <string>())).Returns((string s) => _users.SingleOrDefault(x => x.Email.Address == s));

            _mockUserRepository.Setup(mr => mr.Save(It.IsAny <User>())).Callback((User target) => { _users.Add(target); });

            _mockCreateAccountEmailService.Setup(mr => mr.Send(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Callback(() => { });


            this._tenantRepository          = _mockTenantRepository.Object;
            this._userRepository            = _mockUserRepository.Object;
            this._createAccountEmailService = _mockCreateAccountEmailService.Object;
        }