public void GetAllLocationsAsKeyValuePairShouldReturnCorrectNumber()
        {
            var list = new List <Location>()
            {
                new Location
                {
                    Id   = 1,
                    Name = "Plovdiv/Bulgaria",
                },
                new Location
                {
                    Id   = 2,
                    Name = "Sofia/Bulgaria",
                },
                new Location
                {
                    Id   = 3,
                    Name = "Stara Zagora/Bulgaria",
                },
            };

            var repository = new Mock <IRepository <Location> >();

            repository.Setup(r => r.AllAsNoTracking()).Returns(() => list.AsQueryable());
            var service = new LocationsService(repository.Object);

            var locations = service.GetAllLocationsAsKeyValuePair();

            Assert.Equal(3, locations.Count());
            repository.Verify(x => x.AllAsNoTracking(), Times.Once);
        }
        public void GetAllLocationsAsKeyValuePairShouldReturnZeroForEmptyDatabase()
        {
            var list = new List <Location>();

            var repository = new Mock <IRepository <Location> >();

            repository.Setup(r => r.AllAsNoTracking()).Returns(() => list.AsQueryable());
            var service = new LocationsService(repository.Object);

            var locations = service.GetAllLocationsAsKeyValuePair();

            Assert.Empty(locations);
            repository.Verify(x => x.AllAsNoTracking(), Times.Once);
        }