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

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


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

            var playerStatistic = new PlayerStatistics {
                Player_Statistics_Id = 2, FgPercent = 0.379F, FtPercent = 1.000F, ThreePointersMade = 3, PointsMade = 15, Rebounds = 2, Assists = 6, Steals = 6, Blocks = 5, TurnOvers = 3, Player_Id = 1
            };
            //Act
            await c.Create(playerStatistic);

            var r = await c.Details(db.PlayerStatistics.Find(2).Player_Statistics_Id);


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

            Assert.Equal(db.PlayerStatistics.Find(2).Player_Statistics_Id, model.Player_Statistics_Id);
            Assert.Equal(db.PlayerStatistics.Find(2).Rebounds + db.PlayerStatistics.Find(2).Steals, model.Rebounds + model.Steals);
        }