コード例 #1
0
        public async void AddClubToStadiumSuccess()
        {
            var options = new DbContextOptionsBuilder <SoccerManagerContext>().UseInMemoryDatabase("SoccerManager").Options;

            var context = new SoccerManagerContext(options);

            var ClubsController = new ClubsController(context);

            var StadiumsController = new StadiumsController(context);

            Stadium new_stadium = new Stadium()
            {
                Name     = "Emirates Stadium",
                Location = "London Borough of Islington, London, UK"
            };

            await StadiumsController.PostStadium(new_stadium);

            Club new_club = new Club()
            {
                Name = "Arsenal"
            };

            await ClubsController.PostClub(new_club);

            await StadiumsController.AddClubToStadium(new_stadium.StadiumId, new_club.ClubId);

            Assert.True(new_club.Stadium.StadiumId == new_stadium.StadiumId);
        }
コード例 #2
0
        public async void AddStadiumSucces()
        {
            var options = new DbContextOptionsBuilder <SoccerManagerContext>().UseInMemoryDatabase("SoccerManager").Options;

            var context = new SoccerManagerContext(options);

            var StadiumsController = new StadiumsController(context);

            Stadium new_stadium = new Stadium()
            {
                Name     = "Emirates Stadium",
                Location = "London Borough of Islington, London, UK"
            };

            await StadiumsController.PostStadium(new_stadium);

            Assert.True(new_stadium.StadiumId > 0);
        }