public void ShouldGenerateAnError() { "Give I have an incomplete request".Context(() => { _blitline = new BlitlineApi(); _request = new BlitlineRequest("blah", "https://s3-eu-west-1.amazonaws.com/gdoubleu-blitline/moi.jpg"); var cropFunction = new CropFunction { X = 51, Y = 126, Width = 457 - 126, Height = 382 - 51, Save = new Save { ImageIdentifier = "image_identifier" } }; _request.AddFunction(cropFunction); }); "When I process the request".Do(() => _response = _blitline.ProcessImages(_request)); "Then the response should fail".Observation(() => Assert.True(_response.Failed)); "And the response should contain an error".Observation(() => Assert.NotEmpty(_response.Results.Error)); }
public void CanChangeImageFileExtension() { "Given I have a request which specifies a different file extension".Context(() => { _request = BuildA.Request(r => r .WithApplicationId("a5KqkemeX2RttyYdkOrdug") .WithSourceImageUri( new Uri("https://s3-eu-west-1.amazonaws.com/gdoubleu-test-photos/moi.jpg")) .Crop(f => f.WithDimensions(51, 126, 457 - 126, 382 - 51) .SaveAs( s => s.WithImageIdentifier("file_extension") .WithExtension(Extension.PNG)))); }); "When I process the request".Do(() => _response = _request.Send()); "Then the processed image should contain the new extension".Observation(() => Assert.Contains(".png", _response.Results.Images.First().S3Url)); }
public void CanFixS3Urls() { BlitlineResponse _response = default(BlitlineResponse); BlitlineRequest _request = default(BlitlineRequest); Dictionary<string, string> _imageKeyBucketList = default(Dictionary<string, string>); "Given I have a blitline response with incorrect s3 urls".Context(() => { _response = new BlitlineResponse { Results = new Results { Images = new List<Image> { new Image { ImageIdentifier = "image", S3Url = "http://s3.amazonaws.com/gdoubleu-test-photos/annotate-default.png" } } } }; _request = new BlitlineRequest { FixS3ImageUrl = true, }; _imageKeyBucketList = new Dictionary<string, string> { {"annotate-default.png","gdoubleu-test-photos"} }; }); "When I fix the urls".Do(() => _response.FixS3Urls(_imageKeyBucketList)); "Then the url is correct".Observation(() => Assert.Equal("http://gdoubleu-test-photos.s3.amazonaws.com/annotate-default.png", _response.Results.Images[0].S3Url)); }