public void CanSaveAndGetInfoPNG_UserSetDateAndDuration_UserDateHonoured_DurationHonoured()
        {
            // Arrange
            var form = new UploadForm(_inviteToOverrideAutoValues);

            form.SetDisplayDuration("100", 5, 200);
            form.SetDateIfNotEmpty("2011-12-20");

            using (var ms = new MemoryStream())
            {
                TestFiles.SamplePNG.Save(ms, ImageFormat.Png);

                UploadedFile file = new UploadedImageFile(form, _durationDetectorFactory);
                file.RawContentPath            = _rawContentPath;
                file.ThumbnailAssetContentPath = _thumbnailAssetContentPath;
                file.UploadedStream            = ms;

                // Act
                file.OriginalFileName = "Sample_PNG.png";
                file.SetDateIfUserHasNotProvidedOne("2011 7 8");

                SaveThumbnail(file);

                // Assert
                Assert.AreEqual("Sample_PNG", file.Title);
                Assert.AreEqual(".png", file.Extension);
                Assert.AreEqual(new DateTime(2011, 12, 20), file.Date);
                Assert.AreEqual(PreviewType.Image, file.PreviewType);
                Assert.AreEqual(100, file.DisplayDuration);
            }
        }
        public void CanSaveAndGetInfoJPG_NoUserData()
        {
            // Arrange
            var form = new UploadForm(_inviteToOverrideAutoValues);

            // Act
            using (var ms = new MemoryStream())
            {
                TestFiles.sampleJPG.Save(ms, ImageFormat.Jpeg);

                UploadedFile file = new UploadedImageFile(form, _durationDetectorFactory);
                file.RawContentPath            = _rawContentPath;
                file.ThumbnailAssetContentPath = _thumbnailAssetContentPath;
                file.UploadedStream            = ms;

                // Act
                file.OriginalFileName = "Sample_JPG.jpg";
                file.SetDateIfUserHasNotProvidedOne("2011 7 8");

                SaveThumbnail(file);

                // Assert
                Assert.AreEqual("Sample_JPG", file.Title);
                Assert.AreEqual(".jpg", file.Extension);
                Assert.AreEqual(new DateTime(2011, 7, 8), file.Date);
                Assert.AreEqual(1184183, file.ContentLength);
                Assert.AreEqual(PreviewType.Image, file.PreviewType);
                Assert.AreEqual(-1, file.DisplayDuration);
            }
        }