public void CreatePostAction_ValidModel_RedirectedToDetailsView() { // Arrange var game = new GameResultViewModelBuilder() .WithTournamentId(TOURNAMENT_ID) .Build(); Game expectedGameResult = game.ToDomain(); Game actualGameResult = null; _gameServiceMock.Setup(h => h.Create(It.IsAny <Game>())) .Callback <Game>(r => actualGameResult = r); var sut = BuildSUT(); // Act var result = sut.Create(game) as RedirectToRouteResult; // Assert Assert.AreEqual(DETAILS_ACTION_NAME, result.RouteValues["action"]); }
public void CreatePostAction_ValidModel_Created() { // Arrange var gameResult = new GameResultViewModelBuilder() .WithTournamentId(TOURNAMENT_ID) .Build(); Game expectedGameResult = gameResult.ToDomain(); Game actualGameResult = null; _gameServiceMock.Setup(h => h.Create(It.IsAny <Game>())) .Callback <Game>(r => actualGameResult = r); var sut = BuildSUT(); // Act var result = sut.Create(gameResult) as RedirectToRouteResult; // Assert TestHelper.AreEqual(expectedGameResult, actualGameResult, new GameComparer()); }