Exemple #1
0
            public void Given_a_host_without_dots_sanitize_to_imgix_net_hostname()
            {
                var subject = new ImgixSource("testhost", "testhost");
                var result  = subject.GetUrl("hey/hey.jpg");

                Assert.True(result.ToString().Contains("testhost.imgix.net"));
            }
Exemple #2
0
            public void Given_a_path_it_should_return_a_url_with_that_path()
            {
                var subject = new ImgixSource("testhost", "testhost.imgix.net");
                var result  = subject.GetUrl("hey/hey.jpg");

                Assert.True(result.ToString().Contains("hey/hey.jpg"));
            }
 public void Given_a_path_it_should_request_the_shardId_from_the_shardingStrategy()
 {
     //Arrange
     var mockShardingStrategy = new Mock<IShardingStrategy>();
     mockShardingStrategy.Setup(s => s.GetShardId(It.IsAny<string>(), 1)).Returns(0);
     var subject = new ImgixSource("testhost", "" , new []{ "testhost.imgix.net" }, true, mockShardingStrategy.Object);
     //Act
     subject.GetUrl("testhost.imgix.net");
     //Assert
     mockShardingStrategy.VerifyAll();
 }
Exemple #4
0
            public void Given_a_path_it_should_request_the_shardId_from_the_shardingStrategy()
            {
                //Arrange
                var mockShardingStrategy = new Mock <IShardingStrategy>();

                mockShardingStrategy.Setup(s => s.GetShardId(It.IsAny <string>(), 1)).Returns(0);
                var subject = new ImgixSource("testhost", "", new [] { "testhost.imgix.net" }, true, mockShardingStrategy.Object);

                //Act
                subject.GetUrl("testhost.imgix.net");
                //Assert
                mockShardingStrategy.VerifyAll();
            }
Exemple #5
0
            public void Given_an_empty_path_it_should_throw_ArgumentException()
            {
                var subject = new ImgixSource("testhost", "testhost");

                Assert.Throws <ArgumentException>(() => subject.GetUrl(""));
            }
Exemple #6
0
 /// <summary>
 /// Initializes an options object with a single source
 /// </summary>
 /// <param name="source"></param>
 public ImgixOptions(ImgixSource source) : this(new List<ImgixSource> {source})
 {
 }
 public void Given_an_empty_path_it_should_throw_ArgumentException()
 {
     var subject = new ImgixSource("testhost", "testhost");
     Assert.Throws<ArgumentException>(() => subject.GetUrl(""));
 }
 public void Given_a_path_it_should_return_a_url_with_that_path()
 {
     var subject = new ImgixSource("testhost", "testhost.imgix.net");
     var result = subject.GetUrl("hey/hey.jpg");
     Assert.True(result.ToString().Contains("hey/hey.jpg"));
 }
 public void Given_a_host_without_dots_sanitize_to_imgix_net_hostname()
 {
     var subject = new ImgixSource("testhost", "testhost");
     var result = subject.GetUrl("hey/hey.jpg");
     Assert.True(result.ToString().Contains("testhost.imgix.net"));
 }