Exemplo n.º 1
0
        public async void GamesController_Index_NoGames()
        {
            //Arrange
            var mockGameRepository = new MockGameRepository().MockGetGames(new List <Game>());

            var controller = new GamesController(mockGameRepository.Object);

            //act
            var result = await controller.Index();

            //assert

            Assert.IsAssignableFrom <ActionResult <IEnumerable <Game> > >(result);
            mockGameRepository.VerifyGetGames(Times.Once());
        }
Exemplo n.º 2
0
        public async void GamesController_Game_Delete_Confirmed()
        {
            //Arrange
            var mockGameRepository = new MockGameRepository().MockDeleteGame();

            var controller = new GamesController(mockGameRepository.Object);

            //act
            var result = await controller.DeleteConfirmed(1);

            //assert

            Assert.IsAssignableFrom <ActionResult <Game> >(result);

            // mockGameRepository.VerifyGetGameByID(Times.Once());
            mockGameRepository.VerifyDeleteGame(Times.Once());
        }
Exemplo n.º 3
0
        public async void GamesController_Edit_Game()
        {
            //Arrange
            var mockGame = new Game()
            {
                GameId = 1
            };

            var mockGameRepository = new MockGameRepository().MockGetGameByID(mockGame);
            var controller         = new GamesController(mockGameRepository.Object);

            //act
            var result = await controller.Edit(1);

            //Assert
            Assert.IsAssignableFrom <ActionResult <Game> >(result);
            mockGameRepository.VerifyGetGameByID(Times.Once());
        }