Esempio n. 1
0
 public static IQueryable<Target> ValidTargetsFor(this IQueryable<Target> query, Player player)
 {
     //TODO: Not real!
     return (new Collection<Target>
                 {
                     new Target {Name = "Target 1", Position = new Position(40.751312, -73.9812)}
                 }).AsQueryable();
 }
Esempio n. 2
0
 public ActionResult GetMissions(Player currentPlayer, MissionTypes missionType)
 {
     var missions = _targetRepository.Get.ValidTargetsFor(currentPlayer);
     var map = _mapGenerator.GenerateTargetMap(missions);
     var json = Json(map);
     json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
     return json;
 }
Esempio n. 3
0
        public void SetUp()
        {
            Init();
            _player = new Player { Name = "Name" };
            _userProvider = MockRepository.GenerateMock<IUserProvider>();

            _userProvider.Stub(m => m.CurrentPlayer()).Return(_player);
            _playerBinder = new PlayerBinder(_userProvider);
            _valueProvider.Stub(m => m.GetValue(PropertyName)).Return(new ValueProviderResult(null, null, CultureInfo.CurrentUICulture));
        }
 protected override void Arrange()
 {
     _account = When_retrieving_account.CreateNewAccount();
     _player = new Player
                   {
                       Account = _account,
                       Name = "test1"
                   };
     _playerRepository = new Repository<Player>(_session);
     _playerRepository.Save(_player);
 }
Esempio n. 5
0
        public void SetUp()
        {
            _targets = new Collection<Target>();
            _map = new GoogleMap();
            _player = new Player();

            _mapGenerator = MockRepository.GenerateMock<IMapGenerator>();
            _mapGenerator.Expect(m => m.GenerateTargetMap(null)).Return(_map).IgnoreArguments();

            _targetRepository = new InMemoryRepository<Target>(_targets);
            _controller = new MissionController(_mapGenerator, _targetRepository);
        }
Esempio n. 6
0
 public ActionResult Start(Account currentAccount, CreatePlayerView model)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     var latitude = model.BaseLatitude;
     var longitude = model.BaseLongitude;
     var player = new Player
                      {
                          Account = currentAccount,
                          Name = model.Name,
                          MainLair =
                              CreateFirstBase(model, latitude, longitude)
                      };
     _playerRepository.Save(player);
     return RedirectToAction("Index");
 }
Esempio n. 7
0
        public void Arrange()
        {
            _login = new LoginModel {EmailAddress = _emailAddress, Password = _password};
            _mother = new ObjectMother();
            _account = _mother.GetAccountByEmailAddress(_emailAddress, _password);
            _currentPlayer = new Player
            {
                Account = _account,
                Name = "Player1"
            };

            _accountRepository = new InMemoryRepository<Account>(_account);
            _playerRepository = new InMemoryRepository<Player>(_currentPlayer);

            _formsService = MockRepository.GenerateMock<IFormsService>();

            _controller = new AccountController(_accountRepository, _playerRepository, _formsService);
        }
Esempio n. 8
0
 public void SetUp()
 {
     _player = new Player();
     new RegisterRoutes().Execute();
 }
        public void SetUp()
        {
            _sessionPlayer = new Player();
            _databaseAccount = new Account {EmailAddress = "*****@*****.**"};
            _databasePlayer = new Player { Account = _databaseAccount };
            _sessionAccount = new Account();

            _httpSession = MockRepository.GenerateMock<IHttpSession>();
            _user = MockRepository.GenerateMock<IPrincipal>();
            _identity = MockRepository.GenerateMock<IIdentity>();
            _accountRepository = MockRepository.GenerateMock<IRepository<Account>>();
            _playerRepository = MockRepository.GenerateMock<IRepository<Player>>();

            _user.Stub(m => m.Identity).Return(_identity);
            _identity.Stub(m => m.Name).Return(_databaseAccount.EmailAddress);
            _accountRepository.Stub(m => m.Get).Return((new Collection<Account>{_databaseAccount}).AsQueryable());

            _userProvider = new TestUserProvider(_accountRepository, _playerRepository, _httpSession, _user);
        }
Esempio n. 10
0
 public ActionResult Index(Player currentPlayer, MissionTypes missionType)
 {
     //TODO: make sure player is valid for missionType
     return View(missionType);
 }