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>(); }
public ViewResult Create(Game game) { OperationStatus _opStatus = _service.CreateGame(game.CreatorId, game.Name); ViewBag.OperationStatus = _opStatus; return View(); }
public ViewResult ViewUsers(Game game) { return View(_service.GetAddUserTeamViewModelForGame(game)); }
private OperationStatus MapGameToDtoAndUpdate(Game game) { GameUpdateDto _gameDto = new GameUpdateDto(); _gameDto = Mapper.Map(game, _gameDto); return _games.Update(_gameDto, g => g.Id == _gameDto.Id); }
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; } }