Esempio n. 1
0
        public void ShouldAddImage()
        {
            // arrange
            var image = new Image
            {
                Picture = new byte[1],
                UserId  = Guid.Parse("F94A87D3-BBB1-46C9-A487-57FDE39FB38B"),
                Time    = DateTime.Now
            };

            image.Time = new DateTime(image.Time.Year, image.Time.Month, image.Time.Day, image.Time.Hour, image.Time.Minute, image.Time.Second, image.Time.Kind);

            var dataLayer = new DataLayer.SQL.DataLayer(_connectionString);

            // act
            image = dataLayer.AddImage(image);
            // asserts
            var resultImage = dataLayer.GetImage(image.Id);

            Assert.AreEqual(image.Time, resultImage.Time);
        }
Esempio n. 2
0
        public void ShouldGetLastImages()
        {
            // arrange
            var image = new Image
            {
                Picture = new byte[1],
                UserId  = Guid.Parse("F94A87D3-BBB1-46C9-A487-57FDE39FB38B"),
                Time    = DateTime.Now
            };

            image.Time = new DateTime(image.Time.Year, image.Time.Month, image.Time.Day, image.Time.Hour, image.Time.Minute, image.Time.Second, image.Time.Kind);

            var dataLayer = new DataLayer.SQL.DataLayer(_connectionString);

            // act
            image = dataLayer.AddImage(image);
            List <Image> lastImages = dataLayer.GetLastImages();

            // asserts
            Assert.IsTrue(lastImages.Count > 0);
        }