public void ReturnNull_WhenValidIdParameterAndAdvertHasNotPictures()
        {
            var mockedRepository = new Mock <IRepository <Picture> >();
            var mockedUnitOfWork = new Mock <IUnitOfWork>();
            var pictureService   = new PictureServices(mockedRepository.Object);

            int testAdvertId = 2;

            mockedRepository.Setup(rep => rep.All()).Returns(() => new List <Picture>()
            {
                new Picture()
                {
                    Id = 1, Name = "1.jpg", AdvertId = 1
                },
                new Picture()
                {
                    Id = 2, Name = "2.jpg"
                },
                new Picture()
                {
                    Id = 3, Name = "3.jpg", AdvertId = 1
                },
                new Picture()
                {
                    Id = 4, Name = "4.jpg"
                }
            }.AsQueryable());

            // Act
            var result = pictureService.GetFirstPicturesNameByAdvertId(testAdvertId);

            Assert.AreEqual(null, result);
        }
        public void ReturnCorrectString_WhenValidIdParameter()
        {
            var mockedRepository = new Mock <IRepository <Picture> >();
            var pictureService   = new PictureServices(mockedRepository.Object);

            int    advertId       = 1;
            string expectedResult = "1.jpg";

            mockedRepository.Setup(rep => rep.All()).Returns(() => new List <Picture>()
            {
                new Picture()
                {
                    Id = 1, Name = expectedResult, AdvertId = 1
                },
                new Picture()
                {
                    Id = 2, Name = "2.jpg"
                },
                new Picture()
                {
                    Id = 3, Name = "3.jpg", AdvertId = 1
                },
                new Picture()
                {
                    Id = 4, Name = "4.jpg"
                }
            }.AsQueryable());

            // Act
            var result = pictureService.GetFirstPicturesNameByAdvertId(advertId);

            Assert.AreEqual(expectedResult, result);
        }