public async Task CreateGoesToGameLoopForActiveCiv()
        {
            //Get a test controller
            GameContext          gameContext    = GetTestContext("activeciv_create_successful");
            ActiveCivsController testController = new ActiveCivsController(gameContext);

            //Build a new ActiveCiv
            ActiveCiv activeCiv = new ActiveCiv {
                Id = 10, CivId = 1, GameName = "Create Game Test"
            };

            //Run the controller's Post: Create()
            IActionResult result = await testController.Create(activeCiv);

            //Assert that...
            //...we got a redirect back
            RedirectToActionResult redirect = Assert.IsType <RedirectToActionResult>(result);

            //...the controller is "GameLoop"
            Assert.Equal("GameLoop", redirect.ControllerName);
            //...the action is the index
            Assert.Equal(nameof(GameLoopController.Index), redirect.ActionName);
            //...the route data is the ID of the new active civ
            Assert.Equal(activeCiv.Id, redirect.RouteValues["id"]);
        }
        public void TestCreateFormHasCivs()
        {
            //Get a test controller
            GameContext          gameContext    = GetTestContext("activeciv_create_form");
            ActiveCivsController testController = new ActiveCivsController(gameContext);

            //Grab the output of Get: Create()
            IActionResult result = testController.Create();

            //Assert that...
            //...we got a view back
            ViewResult viewResult = Assert.IsType <ViewResult>(result);

            //...the view data has civ ids
            Assert.NotNull(viewResult.ViewData["CivId"]);
        }
        public async Task CreateReturnsToFormOnInvalidModel()
        {
            //Get a test controller
            GameContext          gameContext    = GetTestContext("activeciv_create_invalid");
            ActiveCivsController testController = new ActiveCivsController(gameContext);

            //Add an error to force the Post: Create() method to return to the form
            testController.ModelState.AddModelError("test error", "automated unit test error");

            //Build a new ActiveCiv
            ActiveCiv activeCiv = new ActiveCiv {
                Id = 10, CivId = 1, GameName = "Create Game Test"
            };

            //Run the controller's Post: Create()
            IActionResult result = await testController.Create(activeCiv);

            //Assert that...
            //...we got a view back
            ViewResult viewResult = Assert.IsType <ViewResult>(result);

            //...the view data has civ ids
            Assert.NotNull(viewResult.ViewData["CivId"]);
        }