コード例 #1
0
        public AccountTestBase()
        {
            AccountRepository           = new MockAccountsRepository();
            AccountPasswordRepository   = new MockAccountPasswordRepository();
            TimeWarpUserStateRepository = new MockUserStateRepository();
            AuthenticationManager       = new MockTimeWarpAuthenticationManager();

            FakeTimeCalculatorFactory.GetTimeWarpStateCalculator();

            var accountCreator = new AccountCreator(AccountRepository, AccountPasswordRepository,
                                                    TimeWarpUserStateRepository, AuthenticationManager);

            AccountController = new AccountController(accountCreator);
        }
コード例 #2
0
        protected UserControllerTestBase()
        {
            FakeNowProvider = new FakeNowProvider {
                Now = new DateTime(2000, 12, 12, 12, 12, 0)
            };
            var usersCache            = new MockUserStateRepository();
            var calc                  = FakeTimeCalculatorFactory.GetTimeWarpStateCalculator();
            var account               = new Account(AccountId, TestHelper.NameMock, TestHelper.EmailAddressMock, AccountType.Full);
            var accountRepository     = new MockAccountsRepository();
            var authenticationManager = new MockTimeWarpAuthenticationManager();
            var token                 = authenticationManager.AddUser(new AccountPassword(account, "bean"));

            accountRepository.Add(account);

            var timeWarpUser = new UserStateManager(calc, usersCache);

            Request = HttpRequestMock.MockRequest();
            Request.Headers.Add("login-token", token);

            Controller = new UserStateController(timeWarpUser, FakeNowProvider, accountRepository, authenticationManager);
        }