示例#1
0
        public GameControllerTest()
        {
            // autofixture automatically creates objects
            _fixture = new Fixture();
            _fixture.Behaviors.Remove(new ThrowingRecursionBehavior());
            _fixture.Behaviors.Add(new OmitOnRecursionBehavior(1)); //Recursion of 1
            _creator = _fixture.Create<UserProfile>();
            _user = _fixture.Create<UserProfile>();
            _game = _fixture.Create<Game>();
            _uteams = new HashSet<UserTeam>();
            _ut = _fixture.Create<UserTeam>();
            _utp = null;
            _games = _fixture.Create<List<Game>>();
            _userteams = _fixture.Create<List<UserTeam>>();

            _mockServiceLayer = new Mock<IService>();
        }
        public ViewPlayersControllerTest()
        {
            // autofixture automatically creates objects
            _fixture = new Fixture();
            _fixture.Behaviors.Remove(new ThrowingRecursionBehavior());
            _fixture.Behaviors.Add(new OmitOnRecursionBehavior(1)); //Recursion of 1
            _creator = _fixture.Create<UserProfile>();
            _user = _fixture.Create<UserProfile>();
            _game = _fixture.Create<Game>();
            _uteams = new HashSet<UserTeam>();
            _ut = _fixture.Create<UserTeam>();
            _utp = null;
            _games = _fixture.Create<List<Game>>();
            _userteams = _fixture.Create<List<UserTeam>>();
            _player = _fixture.Create<Player>();

            // Mock the Players Repository using Moq
            _mockGameRepository = new Mock<IGameRepository>();
            _mockUserTeamRepository = new Mock<IUserTeamRepository>();
            _mockWSW = new Mock<IWebSecurityWrapper>();
            _mockUserRepository = new Mock<IUserRepository>();
            _mockPlayerRepository = new Mock<IPlayerRepository>();
        }
示例#3
0
 public ViewResult Create(Game game)
 {
     OperationStatus _opStatus = _service.CreateGame(game.CreatorId, game.Name);
     ViewBag.OperationStatus = _opStatus;
     return View();
 }
示例#4
0
 public ViewResult ViewUsers(Game game)
 {
     return View(_service.GetAddUserTeamViewModelForGame(game));
 }
示例#5
0
 private OperationStatus MapGameToDtoAndUpdate(Game game)
 {
     GameUpdateDto _gameDto = new GameUpdateDto();
     _gameDto = Mapper.Map(game, _gameDto);
     return _games.Update(_gameDto, g => g.Id == _gameDto.Id);
 }
示例#6
0
 public AddUserTeamViewModel GetAddUserTeamViewModelForGame(Game game)
 {
     try
     {
         IEnumerable<UserProfile> _allusers = _users.GetList();
         return new AddUserTeamViewModel() { Users = _allusers, Game = game };
     }
     catch (Exception _exp)
     {
         OperationStatus.CreateFromException(String.Format("GetAddUserTeamViewModelForGame failed. gameid:{0}", game.Id), _exp, true);
         throw;
     }
 }