Example #1
0
        public void AddRedirectsToTheGameIndexView()
        {
            var mockGamesContext = new MockGamesContext();
            var controller       = new GamesController(mockGamesContext);
            var result           = controller.Add();

            Assert.IsType <RedirectToRouteResult>(result);
            Assert.Equal("Index", result.RouteValues["action"]);
            Assert.Equal("Game", result.RouteValues["controller"]);
        }
Example #2
0
        public void AddValidGame_ExpectOne()
        {
            Game newGame = new Game
            {
                GameId          = 4,
                GameName        = " randomGame",
                Publisher       = "Activision",
                Developer       = "Etranges Libellules",
                Genre           = "Platformer",
                Platform        = "All",
                GameDescription = "SOme new game",
                GameArtUrl      = "https://www.giantbomb.com/images/1300-2136555",
                ReleaseDate     = new DateTime(2008, 10, 21),
                Price           = 50.54
            };

            int result = _controller.Add(newGame);

            Assert.Equal(1, result);
        }