Пример #1
0
        public void ShouldGetLatestPhoto()
        {
            //arrange
            var numOfDaysBefore = 1;
            var dateTo          = DateTime.Now;
            var dateFrom        = DateTime.Now.Subtract(new TimeSpan(numOfDaysBefore, 0, 0, 0));

            //act
            var dataLayer = new DataLayer.Sql.DataLayer(ConnectionSql);

            List <Photo> latestPhotos = dataLayer.GetLatestPhotos(dateFrom, dateTo);
            var          wrongDate    = false;

            foreach (var latestPhoto in latestPhotos)
            {
                if ((latestPhoto.TimeDate < dateFrom) || (latestPhoto.TimeDate > dateTo))
                {
                    wrongDate = true;
                }
            }

            //assert
            Assert.AreEqual(wrongDate, false);
        }