|
@@ -190,42 +190,6 @@ namespace Discord |
|
|
Assert.Equal(result.ThumbnailUrl, url); |
|
|
Assert.Equal(result.ThumbnailUrl, url); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// Tests that invalid urls throw an <see cref="ArgumentException"/>. |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
/// <param name="url">The url to set.</param> |
|
|
|
|
|
[Theory] |
|
|
|
|
|
[InlineData(" ")] |
|
|
|
|
|
[InlineData("not a url")] |
|
|
|
|
|
public void Url_Invalid(string url) |
|
|
|
|
|
{ |
|
|
|
|
|
Assert.Throws<ArgumentException>(() |
|
|
|
|
|
=> new EmbedBuilder() |
|
|
|
|
|
.WithUrl(url)); |
|
|
|
|
|
Assert.Throws<ArgumentException>(() |
|
|
|
|
|
=> new EmbedBuilder() |
|
|
|
|
|
.WithImageUrl(url)); |
|
|
|
|
|
Assert.Throws<ArgumentException>(() |
|
|
|
|
|
=> new EmbedBuilder() |
|
|
|
|
|
.WithThumbnailUrl(url)); |
|
|
|
|
|
|
|
|
|
|
|
Assert.Throws<ArgumentException>(() => |
|
|
|
|
|
{ |
|
|
|
|
|
var b = new EmbedBuilder(); |
|
|
|
|
|
b.Url = url; |
|
|
|
|
|
}); |
|
|
|
|
|
Assert.Throws<ArgumentException>(() => |
|
|
|
|
|
{ |
|
|
|
|
|
var b = new EmbedBuilder(); |
|
|
|
|
|
b.ImageUrl = url; |
|
|
|
|
|
}); |
|
|
|
|
|
Assert.Throws<ArgumentException>(() => |
|
|
|
|
|
{ |
|
|
|
|
|
var b = new EmbedBuilder(); |
|
|
|
|
|
b.ThumbnailUrl = url; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// Tests the value of the <see cref="EmbedBuilder.Length"/> property when there are no fields set. |
|
|
/// Tests the value of the <see cref="EmbedBuilder.Length"/> property when there are no fields set. |
|
|
/// </summary> |
|
|
/// </summary> |
|
@@ -343,24 +307,6 @@ namespace Discord |
|
|
Assert.Equal(name, footer.Text); |
|
|
Assert.Equal(name, footer.Text); |
|
|
} |
|
|
} |
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// Tests that invalid URLs throw an <see cref="ArgumentException"/>. |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
[Fact] |
|
|
|
|
|
public void EmbedFooterBuilder_InvalidURL() |
|
|
|
|
|
{ |
|
|
|
|
|
IEnumerable<string> InvalidUrls() |
|
|
|
|
|
{ |
|
|
|
|
|
yield return "not a url"; |
|
|
|
|
|
} |
|
|
|
|
|
foreach (var url in InvalidUrls()) |
|
|
|
|
|
{ |
|
|
|
|
|
Assert.Throws<ArgumentException>(() => |
|
|
|
|
|
{ |
|
|
|
|
|
new EmbedFooterBuilder().WithIconUrl(url); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// Tests that invalid text throws an <see cref="ArgumentException"/>. |
|
|
/// Tests that invalid text throws an <see cref="ArgumentException"/>. |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
[Fact] |
|
|
[Fact] |
|
|