예제 #1
0
        public void CreateNewAccountTest()
        {
            var accountsCache  = new AccountsCache(Enumerable.Empty <Account>());
            var userStateCache = new UsersCache(Enumerable.Empty <TimeWarpUser>());
            var persistence    = new FakeEntityPersistence <Account>();
            var calc           = FakeTimeCalculatorFactory.GetTimeWarpStateCalculator();
            AccountController accountController = new AccountController(accountsCache, persistence, userStateCache, calc);

            var result = accountController.Post("new user", "eamil@sdaisd", "newPassword");

            var stored = persistence.SavedItems.Single();

            Assert.AreEqual(0, result);
            Assert.AreEqual("new user", stored.Name);
            Assert.AreEqual("eamil@sdaisd", stored.Email);
        }
예제 #2
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;
        }