Exemplo n.º 1
0
        public async void DeleteCoachNotFoundPageTest()
        {
            //Arrange
            var db = MockDb.CreateMockDb();
            var c  = new StadiumsController(db);

            //Act
            var r = await c.Delete(2);


            //Assert
            Assert.IsType <NotFoundResult>(r);
        }
Exemplo n.º 2
0
        public async void DeletePageTest()
        {
            //Arrange
            var db = MockDb.CreateMockDb();
            var c  = new StadiumsController(db);

            var stadiums = new Stadium {
                Stadium_Id = 2, StadiumName = "Ever After", City = "Everett", Team_Id = 1
            };
            //Act
            await c.Create(stadiums);

            var r = await c.Delete(db.Stadium.Find(2).Stadium_Id);


            //Assert
            var result = Assert.IsType <ViewResult>(r);
            var model  = Assert.IsAssignableFrom <Stadium>(result.ViewData.Model);

            Assert.Equal(db.Stadium.Find(2).Stadium_Id, model.Stadium_Id);
            Assert.Equal(db.Stadium.Find(2).StadiumName, model.StadiumName);
        }