public async Task InsertAsync_VerifyInvalidGameState() { //Arrange Game returnedGame = null; var game = new Game() { Author = "Michael", InitialState = "" }; var userMock = new Mock <IHistoryQuery>(); userMock.Setup(x => x.InsertAsync(game)).ReturnsAsync(returnedGame); var service = new GameHistoryController(userMock.Object); //Act var result = await service.Post(game) as NotFoundResult; //Assert Assert.IsType <NotFoundResult>(result); }
public async Task InsertAsync_VerifyObject() { //Arrange var game = new Game() { Author = "Michael", InitialState = "[[true,false],[false,false]]" }; var userMock = new Mock <IHistoryQuery>(); userMock.Setup(x => x.InsertAsync(game)).ReturnsAsync(game); var service = new GameHistoryController(userMock.Object); //Act var result = await service.Post(game) as OkObjectResult; var actualResult = result.Value; //Assert Assert.Equal(game, (Game)actualResult); }