Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        public void JoinAndThenLeaveRoom()
        {
            AddUserToExistingRoom();
            var roomsController = new RoomInfoController(_roomRepository, _accountRepository, _authenticationManager,
                                                         _nowProvider);

            roomsController.Post(_request, 1, UserRoomCommand.Leave);

            Assert.IsTrue(_roomRepository.GetRoom(1) != null);
            Assert.AreEqual(0, _roomRepository.GetRoom(1).NumberOfUsers);
        }
Exemplo n.º 3
0
        public void JoinAndThenLeaveRoom()
        {
            AddUserToExistingRoom();
            var roomsController = new RoomInfoController(_roomsCache, _accountsCache, _entityPersistence,
                                                         _nowProvider);

            roomsController.Put(1, 1, UserRoomCommand.Leave);
            Room room;

            Assert.IsTrue(_roomsCache.TryGet(1, out room));
            Assert.AreEqual(0, _entityPersistence.SavedItems.Last().NumberOfUsers);
        }
Exemplo n.º 4
0
 public ServiceBase()
 {
     CodeCampDataAccess            = new CodeCampInfoController();
     RegistrationDataAccess        = new RegistrationInfoController();
     RoomDataAccess                = new RoomInfoController();
     SessionDataAccess             = new SessionInfoController();
     SessionRegistrationDataAccess = new SessionRegistrationInfoController();
     SessionSpeakerDataAccess      = new SessionSpeakerInfoController();
     SpeakerDataAccess             = new SpeakerInfoController();
     TrackDataAccess               = new TrackInfoController();
     TimeSlotDataAccess            = new TimeSlotInfoController();
     VolunteerDataAccess           = new VolunteerInfoController();
     VolunteerTaskDataAccess       = new VolunteerTaskInfoController();
 }
Exemplo n.º 5
0
        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", "*****@*****.**", "beanland");

            _roomsCache    = new RoomsCache(new[] { testRoom1, testRoom2 });
            _accountsCache = new AccountsCache(new[] { testAccount });

            _entityPersistence = new FakeEntityPersistence <Room>();
            _nowProvider       = new FakeNowProvider();

            var roomsController = new RoomInfoController(_roomsCache, _accountsCache, _entityPersistence,
                                                         _nowProvider);

            _roomInfoController = roomsController;
        }