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