public async Task DeleteNotExistingStadium()
        {
            var countriesList = new List <Country> {
                new Country {
                    Id = 1, Name = "Spain", Code = "SP"
                }
            };
            var stadiumsList = new List <Stadium>();

            var mockCountryRepo = new Mock <IRepository <Country> >();
            var mockStadiumRepo = new Mock <IRepository <Stadium> >();

            mockStadiumRepo.Setup(r => r.All()).Returns(stadiumsList.AsQueryable());

            var stadiumService = new StadiumService(mockStadiumRepo.Object, mockCountryRepo.Object);

            await Assert.ThrowsAsync <Exception>(() => stadiumService.DeleteAsync(1));
        }
        public async Task SaveAndDeleteStadium()
        {
            var countriesList = new List <Country> {
                new Country {
                    Id = 1, Name = "Spain", Code = "SP"
                }
            };
            var stadiumsList = new List <Stadium>();

            var mockCountryRepo = new Mock <IRepository <Country> >();

            mockCountryRepo.Setup(r => r.Get(It.IsAny <int>())).Returns <int>(id => countriesList.FirstOrDefault(c => c.Id == id));

            var mockStadiumRepo = new Mock <IRepository <Stadium> >();

            mockStadiumRepo.Setup(r => r.All()).Returns(stadiumsList.AsQueryable());
            mockStadiumRepo.Setup(r => r.AddAsync(It.IsAny <Stadium>())).Callback <Stadium>(stadium => stadiumsList.Add(new Stadium
            {
                Id       = 1,
                Name     = stadium.Name,
                Capacity = stadium.Capacity,
                Country  = stadium.Country
            }));
            mockStadiumRepo.Setup(r => r.Delete(It.IsAny <Stadium>())).Callback <Stadium>(stadium => stadiumsList.Remove(stadium));

            var stadiumService = new StadiumService(mockStadiumRepo.Object, mockCountryRepo.Object);

            var stadiumViewModel = new StadiumViewModel
            {
                Name      = "Santiago Bernabeu",
                CountryId = 1
            };

            await stadiumService.CreateAsync(stadiumViewModel);

            await stadiumService.DeleteAsync(1);

            Assert.Empty(stadiumService.GetAll(false));
        }