예제 #1
0
        public void T002_GetProperties_MasksFound_ProperList()
        {
            // Arrange
            var propRepo   = new Mock <IGenericRepository <PropertyDictionary> >();
            var properDict = new List <PropertyDictionary>
            {
                new PropertyDictionary()
                {
                    Name = Mask2, Mask = 2
                },
                new PropertyDictionary()
                {
                    Name = Mask4, Mask = 4
                },
                new PropertyDictionary()
                {
                    Name = Mask8, Mask = 8
                }
            };

            propRepo.Setup(x => x.GetSet()).Returns(properDict);
            // Act
            var getPropertiesByAdvertType = new GetPropertiesByAdvertType(propRepo.Object);
            var result = getPropertiesByAdvertType.GetProperties(new AdvertTypeViewModel()
            {
                Mask = 6
            });

            // Assert
            Assert.AreEqual(result.Count, 2);
            Assert.AreEqual(result.First().Name, Mask2);
            Assert.AreEqual(result.Last().Name, Mask4);
        }
예제 #2
0
        public void T001_GetProperties_MaskNotFound_EmptyList()
        {
            // Arrange
            var propRepo = new Mock <IGenericRepository <PropertyDictionary> >();

            propRepo.Setup(x => x.GetSet()).Returns(new List <PropertyDictionary>());

            // Act
            var getPropertiesByAdvertType = new GetPropertiesByAdvertType(propRepo.Object);
            var result = getPropertiesByAdvertType.GetProperties(new AdvertTypeViewModel()
            {
                Mask = 1
            });

            // Assert
            Assert.AreEqual(result.Any(), false);
        }