Ejemplo n.º 1
0
        public void CheckIfGettingAllAsKvpWorksCorrectly()
        {
            var list = new List <Country>()
            {
                new Country()
                {
                    Id   = 1,
                    Name = "Bulgaria",
                },
                new Country()
                {
                    Id   = 2,
                    Name = "Germany",
                },
            };
            var mockRepo = new Mock <IRepository <Country> >();

            mockRepo.Setup(x => x.AllAsNoTracking()).Returns(list.AsQueryable());
            var service = new CountriesService(mockRepo.Object);

            var actualResult = service.GetAllAsKvp();

            Assert.Equal(2, actualResult.Count());
            Assert.Equal("Bulgaria", actualResult.First().Value);
        }