public void SetupController() { //arrange var testRoom1 = new Room(1, "testRoom1", new DateTime(2000, 12, 12)); var testRoom2 = new Room(2, "testRoom2", new DateTime(2001, 12, 12)); var testAccount = new Account(1, "ashley", "*****@*****.**", AccountType.Full); _authenticationManager = new MockTimeWarpAuthenticationManager(); var token = _authenticationManager.AddUser(new AccountPassword(testAccount, "")); _request = HttpRequestMock.MockRequest(); _request.Headers.Add("login-token", token); _roomRepository = new MockRoomRepository(); _roomRepository.Add(testRoom1); _roomRepository.Add(testRoom2); _accountRepository = new MockAccountsRepository(); _accountRepository.Add(testAccount); _nowProvider = new FakeNowProvider(); var roomsController = new RoomInfoController(_roomRepository, _accountRepository, _authenticationManager, _nowProvider); _globalRoomInfoController = new GlobalRoomInfoController(_roomRepository); _roomInfoController = roomsController; }
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); }