public void ThenSetsPhotoAndReturnsEmptyValidationResults()
        {
            var stream        = _assembly.GetManifestResourceStream("MileageStats.Services.Tests.TestContent.TestVehiclePhoto.png");
            var contentLength = (int)stream.Length;
            var contentType   = "/image/png";

            var handler = new CanAddPhoto();
            var result  = handler.Execute(stream, contentLength, contentType);

            Assert.Empty(result);
        }
        public void WhenValidateVehiclePhotoWithPhotoThatIsTooLargeAndFakeContentLength_ThenReturnsValidationError()
        {
            var stream        = _assembly.GetManifestResourceStream("MileageStats.Services.Tests.TestContent.FileTooBig.jpg");
            var contentLength = 990;
            var contentType   = "/image/png";

            var handler = new CanAddPhoto();
            var result  = handler.Execute(stream, contentLength, contentType);

            Assert.Equal(1, result.Count());
            Assert.Contains("must be less than", result.First().Message, StringComparison.CurrentCultureIgnoreCase);
        }
        public void WithNonImageFile_ThenReturnsValidationError()
        {
            var stream        = _assembly.GetManifestResourceStream("MileageStats.Services.Tests.TestContent.NotAnImage.bin");
            var contentLength = (int)stream.Length;
            var contentType   = "/image/png";

            var handler = new CanAddPhoto();
            var result  = handler.Execute(stream, contentLength, contentType);

            Assert.Equal(1, result.Count());
            Assert.Contains("not an image", result.First().Message, StringComparison.CurrentCultureIgnoreCase);
        }