예제 #1
0
            public void Should_sign_the_image_if_token_is_set()
            {
                //Arrange
                var image = Imgix.CreateImage(new ImgixOptions(new ImgixSource(_sourceName, "FOO123bar", _host, true)), "/users/1.png");

                //Act
                //Assert
                ImgixImageAsserts.HasQueryParameter(image, "s", "6797c24146142d5b40bde3141fd3600c");
            }
예제 #2
0
        public void Given_a_simple_path_it_should_sign_the_url_correctly()
        {
            //Arrange
            var image = Imgix.CreateImage(new ImgixOptions(new ImgixSource("TestSource", "FOO123bar", "TestSource")), "/users/1.png");

            //Act
            //Assert
            ImgixImageAsserts.HasQueryParameter(image, "s", "6797c24146142d5b40bde3141fd3600c");
        }
예제 #3
0
        public void Given_A_fully_qualified_url_in_path_it_should_sign_the_url_correctly()
        {
            //Arrange
            var image = Imgix.CreateImage(new ImgixOptions(new ImgixSource("TestSource", "FOO123bar", "TestSource")), "http://avatars.com/john-smith.png");

            //Act
            //Assert
            ImgixImageAsserts.HasQueryParameter(image, "s", "493a52f008c91416351f8b33d4883135");
        }
예제 #4
0
            public void Should_add_parameter_to_new_image_object()
            {
                //Arrange
                var image = Imgix.CreateImage(new ImgixOptions(new ImgixSource(_sourceName, _host)), _imagePath);
                //Act
                var result = image.AddParameter("test1", "test1");

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "test1", "test1");
            }
예제 #5
0
            public void Should_add_a_query_parameter_called_w_with_the_given_integer_value()
            {
                //Arrange
                const int width = 200;
                //Act
                var result = Image.Width(width);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "w", width.ToString());
            }
예제 #6
0
            public void Should_add_a_query_parameter_called_h_with_the_given_float_value()
            {
                //Arrange
                const string height = "0.9";
                //Act
                var result = Image.Height(height);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "h", height);
            }
예제 #7
0
            public void Should_add_a_query_parameter_called_h_with_the_given_float_value()
            {
                //Arrange
                var height = 0.9;
                //Act
                var result = Image.Height(height);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "h", height.ToString(CultureInfo.InvariantCulture));
            }
예제 #8
0
            public void Should_add_a_query_parameter_called_h_with_the_given_integer_value()
            {
                //Arrange
                var height = 200;
                //Act
                var result = Image.Height(height);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "h", height.ToString());
            }
예제 #9
0
            public void Should_add_a_query_parameter_called_fit_with_the_given_string_value()
            {
                //Arrange
                const string fit = "clip";
                //Act
                var result = Image.Fit(fit);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "fit", fit);
            }
예제 #10
0
            public void Should_add_a_query_parameter_called_crop_with_the_given_string_value()
            {
                //Arrange
                const string crop = "top";
                //Act
                var result = Image.Crop(crop);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "crop", crop);
            }
예제 #11
0
            public void Should_add_a_query_parameter_called_rect_with_value_from_dimensions()
            {
                //Arrange
                const string dimensions = "0,0,200,200";
                //Act
                var result = Image.Rect(dimensions);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "rect", dimensions);
            }
예제 #12
0
        public void Given_a_simple_path_with_width_and_height_it_should_sign_the_url_correctly()
        {
            //Arrange
            var image = Imgix.CreateImage(new ImgixOptions(new ImgixSource("TestSource", "FOO123bar", "TestSource")), "/users/1.png");
            //Act
            var result = image.Width(400).Height(300);

            //Assert
            ImgixImageAsserts.HasQueryParameter(result, "s", "c7b86f666a832434dd38577e38cf86d1");
        }
예제 #13
0
            public void Should_add_a_query_parameter_called_w_with_the_given_float_value()
            {
                //Arrange
                const double width = 0.9;
                //Act
                var result = Image.Width(width);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "w", width.ToString(CultureInfo.InvariantCulture));
            }
예제 #14
0
            public void Should_add_a_query_parameter_called_w_with_the_given_string_value()
            {
                //Arrange
                const string width = "0.9";
                //Act
                var result = Image.Width(width);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "w", width);
            }
예제 #15
0
        public void Given_A_fully_qualified_url_in_path_and_a_width_and_a_height_it_should_sign_the_url_correctly()
        {
            //Arrange
            var image = Imgix.CreateImage(new ImgixOptions(new ImgixSource("TestSource", "FOO123bar", "TestSource")), "http://avatars.com/john-smith.png");

            //Act
            var result = image.Width(400).Height(300);

            //Assert
            ImgixImageAsserts.HasQueryParameter(result, "s", "61ea1cc7add87653bb0695fe25f2b534");
        }
예제 #16
0
            public void Should_add_a_query_parameter_called_rect_with_values_given()
            {
                //Arrange
                const int x                  = 100;
                const int y                  = 50;
                const int width              = 200;
                const int height             = 200;
                var       expectedDimensions = $"{x},{y},{width},{height}";
                //Act
                var result = Image.Rect(x, y, width, height);

                //Assert
                ImgixImageAsserts.HasQueryParameter(result, "rect", expectedDimensions);
            }
예제 #17
0
 public void Given_an_integer_it_should_add_a_px_parameter_with_the_integer_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Pixellate(50), "px", "50");
 }
예제 #18
0
 public void Given_an_integer_it_should_add_a_parameter_page_with_the_value_of_the_integer()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Page(1), "page", "1");
 }
예제 #19
0
 public void Given_a_string_it_will_add_a_parameter_border_with_the_string_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Border("border=10,000"), "border", "border=10,000");
 }
예제 #20
0
 public void Given_multiple_AutoTransform_it_will_add_them_all_seperated_by_commas()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Auto(AutoOperation.Format, AutoOperation.Redeye), "auto", "format,redeye");
 }
예제 #21
0
 public void Given_an_AutoTransform_Format_an_auto_parameter_format_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Auto(AutoOperation.Format), "auto", "format");
 }
예제 #22
0
 public void It_should_add_a_mask_parameter_with_the_value_ellipse()
 {
     ImgixImageAsserts.HasQueryParameter(Image.EllipseMask(), "mask", "ellipse");
 }
예제 #23
0
 public void Given_an_AutoTransform_Enhance_an_auto_parameter_enhance_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Auto(AutoOperation.Enhance), "auto", "enhance");
 }
예제 #24
0
 public void Given_a_string_an_auto_parameter_is_added_with_the_string_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Auto("enhance"), "auto", "enhance");
 }
예제 #25
0
 public void Given_a_string_it_will_add_a_parameter_prefix_with_the_value_of_the_string()
 {
     ImgixImageAsserts.HasQueryParameter(Image.CSSPrefix("ThisIsAPrefix"), "prefix", "ThisIsAPrefix");
 }
예제 #26
0
 public void Given_a_string_it_will_add_a_parameter_palette_with_the_value_of_the_string()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Palette("json"), "palette", "json");
 }
예제 #27
0
 public void Given_an_integer_it_should_add_a_parameter_colors_with_the_value_of_the_integer()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Colors(1), "colors", "1");
 }
예제 #28
0
 public void Given_an_AutoTransform_Redeye_an_auto_parameter_redeye_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Auto(AutoOperation.Redeye), "auto", "redeye");
 }
예제 #29
0
 public void Given_a_string_it_should_add_a_parameter_mask_with_the_string_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Mask("some/path/or/url.jpg?"), "mask", "some/path/or/url.jpg?");
 }
예제 #30
0
 public void Given_an_integer_it_should_add_a_sepia_parameter_with_the_integer_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.SepiaTone(50), "sepia", "50");
 }