public void DefaultingTo_UrlWithQueryComponentAsAsciiCode_ThrowsException() { Should.Throw <ArgumentException>(() => Gravatar.For("*****@*****.**").DefaultingTo("http://example.com/my-image.jpg%3fquery-compoents=are-not-allowed")) .Message.ShouldContain("URLs for default avatars cannot contain query components."); }
public void DefaultingToEnum_SetToUrl_ThrowsArgumentException() { Should.Throw <ArgumentException>(() => Gravatar.For("*****@*****.**").DefaultingTo(GravatarDefaultImage.Url)) .Message.ShouldContain("Use the string version of DefaultingTo to set the URL."); }
public void WithSize_UnderMinSize_ThrowsException() { Should.Throw <ArgumentOutOfRangeException>(() => Gravatar.For("*****@*****.**").WithSize(0)) .Message.ShouldContain("Gravatar images can be between 1 and 2048 pixels."); }
public void ForInsecureDefaultImageUrl_EmailAddress_InsecureDefaultUrl() { string url = Gravatar.For("*****@*****.**").OnInsecureProtocol.DefaultingTo("http://example.com/my-image.jpg").Url; url.ShouldBe("http://www.gravatar.com/avatar/17ed90ef2174cc9f2b7e60e8c3e8d3d1?d=http%3a%2f%2fexample.com%2fmy-image.jpg"); }
public void ForSecureUrl_EmailAddress_SecureUrl() { string url = Gravatar.For("*****@*****.**").OnSecureProtocol.Url; url.ShouldBe("https://secure.gravatar.com/avatar/df39135b5108b526c44200843ed50eb5"); }
public void ForInsecureSize64Url_EmailAddress_Insecure64Url() { string url = Gravatar.For("*****@*****.**").OnInsecureProtocol.WithSize(64).Url; url.ShouldBe("http://www.gravatar.com/avatar/df39135b5108b526c44200843ed50eb5?s=64"); }
public void RatedAs_X_AddseXtremeRatingQueryComponent() { string url = Gravatar.For("*****@*****.**").OnInsecureProtocol.RatedAs(GravatarRating.X).Url; url.ShouldBe("http://www.gravatar.com/avatar/df39135b5108b526c44200843ed50eb5?r=x"); }
public void RatedAs_G_DoesntSetRating() { string url = Gravatar.For("*****@*****.**").OnInsecureProtocol.RatedAs(GravatarRating.G).Url; url.ShouldBe("http://www.gravatar.com/avatar/df39135b5108b526c44200843ed50eb5"); }
public void AlwaysDefaultingTo_MonsterId_SetsDquerycomponentToMonsterIdAndFToY() { string url = Gravatar.For("*****@*****.**").OnInsecureProtocol.Always.DefaultingTo(GravatarDefaultImage.MonsterId).Url; url.ShouldBe("http://www.gravatar.com/avatar/df39135b5108b526c44200843ed50eb5?d=monsterid&f=y"); }
public void DefaultingTo_Blank_SetsDquerycomponentToBlank() { string url = Gravatar.For("*****@*****.**").OnInsecureProtocol.DefaultingTo(GravatarDefaultImage.Blank).Url; url.ShouldBe("http://www.gravatar.com/avatar/df39135b5108b526c44200843ed50eb5?d=blank"); }
public void For_NullAddress_ThrowsException() { Should.Throw <ArgumentNullException>(() => Gravatar.For(null)) .ParamName.ShouldBe("emailAddress"); }