Exemple #1
0
        public void GetAllConditionsListShouldHaveCorrectCount()
        {
            var list = new List <AutopartCondition>()
            {
                new AutopartCondition
                {
                    Id   = 1,
                    Name = "test",
                },
                new AutopartCondition
                {
                    Id   = 2,
                    Name = "test",
                },
            };

            this.conditionsRepository
            .Setup(x => x.AllAsNoTracking())
            .Returns(list.AsQueryable());

            var service = new AutopartsCharacteristicsService(
                this.categoriesRepository.Object,
                this.conditionsRepository.Object);

            Assert.Equal(2, service.GetAllAutopartConditions().Count());
        }
Exemple #2
0
        public void GetAllConditionsReturnsCorrectValues()
        {
            var autopartCondition1 = new AutopartCondition
            {
                Id   = 1,
                Name = "Value 1",
            };

            var autopartCondition2 = new AutopartCondition
            {
                Id   = 2,
                Name = "Value 2",
            };

            var list = new List <AutopartCondition>
            {
                autopartCondition1,
                autopartCondition2,
            };

            this.conditionsRepository
            .Setup(x => x.AllAsNoTracking())
            .Returns(list.AsQueryable());

            var service = new AutopartsCharacteristicsService(
                this.categoriesRepository.Object,
                this.conditionsRepository.Object);

            var result = service.GetAllAutopartConditions().ToList();

            Assert.Equal(autopartCondition1.Id, result[0].Id);
            Assert.Equal(autopartCondition2.Id, result[1].Id);

            Assert.Equal(autopartCondition1.Name, result[0].Value);
            Assert.Equal(autopartCondition2.Name, result[1].Value);
        }