Ejemplo n.º 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");
            }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
            }
Ejemplo n.º 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());
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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));
            }
Ejemplo n.º 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());
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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");
        }
Ejemplo n.º 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));
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
            }
Ejemplo n.º 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");
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 21
0
 public void Given_an_AutoTransform_Format_an_auto_parameter_format_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Auto(AutoOperation.Format), "auto", "format");
 }
Ejemplo n.º 22
0
 public void It_should_add_a_mask_parameter_with_the_value_ellipse()
 {
     ImgixImageAsserts.HasQueryParameter(Image.EllipseMask(), "mask", "ellipse");
 }
Ejemplo n.º 23
0
 public void Given_an_AutoTransform_Enhance_an_auto_parameter_enhance_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Auto(AutoOperation.Enhance), "auto", "enhance");
 }
Ejemplo n.º 24
0
 public void Given_a_string_an_auto_parameter_is_added_with_the_string_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Auto("enhance"), "auto", "enhance");
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 28
0
 public void Given_an_AutoTransform_Redeye_an_auto_parameter_redeye_as_value()
 {
     ImgixImageAsserts.HasQueryParameter(Image.Auto(AutoOperation.Redeye), "auto", "redeye");
 }
Ejemplo n.º 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?");
 }
Ejemplo n.º 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");
 }