public void Setup()
        {
            gameId = new Guid("44B0752E-998B-466A-AAAD-3ED535BA3559");
            GameSKUId = new Guid("3FE5BFCF-0A01-4EC2-A662-ADA08A2C34D2");

            game = new Game
            {
                Id = gameId,
                Name = "A game"
            };

            ps4Platform = new Platform
            {
                PlatformCode = "PS4",
                PlatformName = "Playstation 4"
            };

            veilCompany = new Company()
            {
                Id = new Guid("B4FDA176-1EA6-469A-BB02-75125D811ED4"),
                Name = "Veil"
            };

            physicalGameProduct = new PhysicalGameProduct
            {
                Id = new Guid("E7746CD1-106E-4622-BC10-E13CCCCA7AC9"),
                GameId = game.Id
            };

            downloadGameProduct = new DownloadGameProduct
            {
                Id = new Guid("2A1474A0-7ABA-41D6-BBD1-2DF28F43786E"),
                GameId = game.Id
            };
        }
        public async void CreateDownloadSKU_POST_SaveChangesCalledOnce()
        {
            Mock<IVeilDataAccess> dbStub = TestHelpers.GetVeilDataAccessFake();
            dbStub.Setup(db => db.SaveChangesAsync()).ReturnsAsync(1).Verifiable();
            MockGames(dbStub);
            MockEmptyGameProducts(dbStub);

            GameProductsController controller = new GameProductsController(dbStub.Object, idGetter: null);

            var gameProduct = new DownloadGameProduct();

            await controller.CreateDownloadSKU(game.Id, gameProduct);

            Assert.That(() => dbStub.Verify(db => db.SaveChangesAsync(), Times.Once), Throws.Nothing);
        }
        public async void CreateDownloadSKU_POST_ModelStateIsNotValid()
        {
            Mock<IVeilDataAccess> dbStub = TestHelpers.GetVeilDataAccessFake();
            MockGames(dbStub);
            MockPlatforms(dbStub);
            MockCompanies(dbStub);

            GameProductsController controller = new GameProductsController(dbStub.Object, idGetter: null);
            controller.ModelState.AddModelError("Name", "Name is required");

            var gameProduct = new DownloadGameProduct();

            var result = await controller.CreateDownloadSKU(game.Id, gameProduct) as ViewResult;

            Assert.That(result != null);
            Assert.That(result.Model, Is.InstanceOf<DownloadGameProduct>());
        }
        public async Task<ActionResult> EditDownloadSKU(Guid? id, DownloadGameProduct gameProduct)
        {
            if (id == null)
            {
                throw new HttpException(NotFound, "Download Game Product");
            }

            if (ModelState.IsValid)
            {
                db.MarkAsModified(gameProduct);
                await db.SaveChangesAsync();

                this.AddAlert(AlertType.Success, "Successfully edited the Download Game Product");
                return RedirectToAction("Details", "Games", new { id = gameProduct.GameId });
            }

            SetupGameProductSelectLists();

            return View(gameProduct);
        }