public void MustSaveGetUpdateGame() { //Given var domainNotification = serviceProvider.GetService <INotificationHandler <DomainNotification> >(); var mediator = serviceProvider.GetService <IMediatorHandler>(); var gameService = serviceProvider.GetService <IGameService>(); var controller = new GameController(domainNotification, mediator); var gameViewModel = FixtureCreateObject.ViewModelGenerator <GameViewModel>(); //When //Save var result = controller.Post(gameService, gameViewModel); var response = GetResponse <GameViewModel>(result); //Recovery var getValue = controller.Get(gameService, response.Data.Id); var getResponse = GetResponse <GameViewModel>(getValue); //Update and Persist var modelUpdate = getResponse.Data; modelUpdate.Name = "Novo Nome"; controller.Put(gameService, modelUpdate); //Get updated value var getFinal = controller.Get(gameService, response.Data.Id); var getResponseFinal = GetResponse <GameViewModel>(getFinal); //Then getResponseFinal.Data.Name.Should().Be("Novo Nome"); }
private Game GameGenerator() { var game = FixtureCreateObject.EntityGenerator <Game>(); var novo = new Game( game.Id, game.Name, game.Description ); return(novo); }
public void MustSaveGame() { //Given var domainNotification = serviceProvider.GetService <INotificationHandler <DomainNotification> >(); var mediator = serviceProvider.GetService <IMediatorHandler>(); var gameService = serviceProvider.GetService <IGameService>(); var controller = new GameController(domainNotification, mediator); var gameViewModel = FixtureCreateObject.ViewModelGenerator <GameViewModel>(); //When var result = controller.Post(gameService, gameViewModel); var response = GetResponse <GameViewModel>(result); //Then response.Data.Id.Should().NotBeEmpty(); response.Data.Id.Should().NotBe(Guid.Empty); }