public void Setup() { var playersRepository = Ioc.Get<IPlayersRepository>() as PlayersRepositoryStub; playersRepository.Players.Clear(); _player = null; _httpNotFoundResult = null; }
public void GetById_CallsRepository() { var player = new Player(); _playersRepository.Setup(x => x.GetById(123)).Returns(player); var actual = _playersManager.GetPlayerById(123); Assert.AreEqual(player, actual); _playersRepository.Verify(x => x.GetById(123)); }
public void Details_CallsPlayerManager() { var player = new Player {Id = 4}; _rosterManager.Setup(x => x.GetPlayerById(4)).Returns(player); var result = _rosterController.Details(4) as ViewResult; var actual = result.Model as Player; Assert.IsNotNull(actual); Assert.AreEqual(player, actual); _rosterManager.Verify(x => x.GetPlayerById(4)); }
public void WhenIGetAPlayerWhoseIdIs(int playerId) { var result = Ioc.Get<RosterController>().Details(playerId); if (result as ViewResult != null) { var viewResult = result as ViewResult; _player = viewResult.Model as Player; } else _httpNotFoundResult = result as HttpNotFoundResult; }