Ejemplo n.º 1
0
            public void Given_useHttps_is_false_it_should_create_a_new_image_using_http()
            {
                string result = Imgix.CreateImage(_imagePath, _host, false);

                Assert.True(result.StartsWith("http"));
                Assert.False(result.StartsWith("https"));
            }
Ejemplo n.º 2
0
            public void Given_an_options_object_with_useHttps_false_it_should_create_a_new_image_using_http()
            {
                string result = Imgix.CreateImage(new ImgixOptions(new ImgixSource(_sourceName, _host, false)), _imagePath);

                Assert.True(result.StartsWith("http"));
                Assert.False(result.StartsWith("https"));
            }
Ejemplo n.º 3
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.º 4
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.º 5
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.º 6
0
        public void Given_no_token_the_url_should_not_be_signed()
        {
            //Arrange
            var image = Imgix.CreateImage(new ImgixOptions(new ImgixSource("TestSource", "TestSourceHost")), "/users/1.png");
            //Act
            var result = image.Width(400).Height(300);

            //Assert
            Assert.False(result.ToString().Contains("s="));
        }
Ejemplo n.º 7
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.º 8
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.º 9
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.º 10
0
 public void MainFixtureInit()
 {
     Image = Imgix.CreateImage(new ImgixOptions(new ImgixSource("sourceName", "sourceName")), "some/path/to/some/image.jpg");
 }
Ejemplo n.º 11
0
 public void Init()
 {
     _image = Imgix.CreateImage(new ImgixOptions(new ImgixSource(_sourceName, _host)), _imagePath);
 }
Ejemplo n.º 12
0
            public void Given_imagePath_and_host_it_should_create_a_new_image_with_host()
            {
                string result = Imgix.CreateImage(_imagePath, _host);

                Assert.AreEqual(_host, new Uri(result).Host);
            }
Ejemplo n.º 13
0
            public void Given_imagePath_and_host_it_should_create_a_new_image_with_path()
            {
                string result = Imgix.CreateImage(_imagePath, _host);

                Assert.True(result.EndsWith(_imagePath));
            }
Ejemplo n.º 14
0
            public void Given_an_options_object_and_a_path_it_should_create_a_new_image_with_the_supplied_path()
            {
                string result = Imgix.CreateImage(new ImgixOptions(new ImgixSource(_sourceName, _host)), _imagePath);

                Assert.True(result.EndsWith(_imagePath));
            }