Browse Source

Capitlazation fixes (#192)

pull/1923/head
Simon Hjorthøj GitHub 3 years ago
parent
commit
ad34d8b7b1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 48 deletions
  1. +1
    -1
      samples/idn/Inspector.cs
  2. +1
    -1
      samples/idn/Program.cs
  3. +1
    -1
      src/Discord.Net.WebSocket/API/Gateway/InviteCreatedEvent.cs
  4. +45
    -45
      test/Discord.Net.Tests.Unit/EmbedBuilderTests.cs

+ 1
- 1
samples/idn/Inspector.cs View File

@@ -3,7 +3,7 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;


namespace idn
namespace Idn
{ {
public static class Inspector public static class Inspector
{ {


+ 1
- 1
samples/idn/Program.cs View File

@@ -13,7 +13,7 @@ using System.Threading;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;


namespace idn
namespace Idn
{ {
public class Program public class Program
{ {


+ 1
- 1
src/Discord.Net.WebSocket/API/Gateway/InviteCreatedEvent.cs View File

@@ -19,7 +19,7 @@ namespace Discord.API.Gateway
[JsonProperty("guild_id")] [JsonProperty("guild_id")]
public ulong? GuildID { get; set; } public ulong? GuildID { get; set; }
[JsonProperty("inviter")] [JsonProperty("inviter")]
public Optional<User> inviter { get; set; }
public Optional<User> Inviter { get; set; }
[JsonProperty("max_age")] [JsonProperty("max_age")]
public int RawAge { get; set; } public int RawAge { get; set; }
[JsonProperty("max_uses")] [JsonProperty("max_uses")]


+ 45
- 45
test/Discord.Net.Tests.Unit/EmbedBuilderTests.cs View File

@@ -9,9 +9,9 @@ namespace Discord
/// </summary> /// </summary>
public class EmbedBuilderTests public class EmbedBuilderTests
{ {
private const string name = "chrisj";
private const string icon = "https://meowpuffygottem.fun/blob.png";
private const string url = "https://meowpuffygottem.fun/";
private const string Name = "chrisj";
private const string Icon = "https://meowpuffygottem.fun/blob.png";
private const string Url = "https://meowpuffygottem.fun/";


/// <summary> /// <summary>
/// Tests the behavior of <see cref="EmbedBuilder.WithAuthor(string, string, string)"/>. /// Tests the behavior of <see cref="EmbedBuilder.WithAuthor(string, string, string)"/>.
@@ -24,12 +24,12 @@ namespace Discord
Assert.Null(builder.Author); Assert.Null(builder.Author);


builder = new EmbedBuilder() builder = new EmbedBuilder()
.WithAuthor(name, icon, url);
.WithAuthor(Name, Icon, Url);


Assert.NotNull(builder.Author); Assert.NotNull(builder.Author);
Assert.Equal(name, builder.Author.Name);
Assert.Equal(icon, builder.Author.IconUrl);
Assert.Equal(url, builder.Author.Url);
Assert.Equal(Name, builder.Author.Name);
Assert.Equal(Icon, builder.Author.IconUrl);
Assert.Equal(Url, builder.Author.Url);
} }


/// <summary> /// <summary>
@@ -39,15 +39,15 @@ namespace Discord
public void WithAuthor_AuthorBuilder() public void WithAuthor_AuthorBuilder()
{ {
var author = new EmbedAuthorBuilder() var author = new EmbedAuthorBuilder()
.WithIconUrl(icon)
.WithName(name)
.WithUrl(url);
.WithIconUrl(Icon)
.WithName(Name)
.WithUrl(Url);
var builder = new EmbedBuilder() var builder = new EmbedBuilder()
.WithAuthor(author); .WithAuthor(author);
Assert.NotNull(builder.Author); Assert.NotNull(builder.Author);
Assert.Equal(name, builder.Author.Name);
Assert.Equal(icon, builder.Author.IconUrl);
Assert.Equal(url, builder.Author.Url);
Assert.Equal(Name, builder.Author.Name);
Assert.Equal(Icon, builder.Author.IconUrl);
Assert.Equal(Url, builder.Author.Url);
} }


/// <summary> /// <summary>
@@ -58,13 +58,13 @@ namespace Discord
{ {
var builder = new EmbedBuilder() var builder = new EmbedBuilder()
.WithAuthor((author) => .WithAuthor((author) =>
author.WithIconUrl(icon)
.WithName(name)
.WithUrl(url));
author.WithIconUrl(Icon)
.WithName(Name)
.WithUrl(Url));
Assert.NotNull(builder.Author); Assert.NotNull(builder.Author);
Assert.Equal(name, builder.Author.Name);
Assert.Equal(icon, builder.Author.IconUrl);
Assert.Equal(url, builder.Author.Url);
Assert.Equal(Name, builder.Author.Name);
Assert.Equal(Icon, builder.Author.IconUrl);
Assert.Equal(Url, builder.Author.Url);
} }


/// <summary> /// <summary>
@@ -74,12 +74,12 @@ namespace Discord
public void EmbedAuthorBuilder() public void EmbedAuthorBuilder()
{ {
var builder = new EmbedAuthorBuilder() var builder = new EmbedAuthorBuilder()
.WithIconUrl(icon)
.WithName(name)
.WithUrl(url);
Assert.Equal(icon, builder.IconUrl);
Assert.Equal(name, builder.Name);
Assert.Equal(url, builder.Url);
.WithIconUrl(Icon)
.WithName(Name)
.WithUrl(Url);
Assert.Equal(Icon, builder.IconUrl);
Assert.Equal(Name, builder.Name);
Assert.Equal(Url, builder.Url);
} }


/// <summary> /// <summary>
@@ -217,15 +217,15 @@ namespace Discord
public void Length() public void Length()
{ {
var e = new EmbedBuilder() var e = new EmbedBuilder()
.WithAuthor(name, icon, url)
.WithAuthor(Name, Icon, Url)
.WithColor(Color.Blue) .WithColor(Color.Blue)
.WithDescription("This is the test description.") .WithDescription("This is the test description.")
.WithFooter("This is the footer", url)
.WithImageUrl(url)
.WithThumbnailUrl(url)
.WithFooter("This is the footer", Url)
.WithImageUrl(Url)
.WithThumbnailUrl(Url)
.WithTimestamp(DateTimeOffset.MinValue) .WithTimestamp(DateTimeOffset.MinValue)
.WithTitle("This is the title") .WithTitle("This is the title")
.WithUrl(url)
.WithUrl(Url)
.AddField("Field 1", "Inline", true) .AddField("Field 1", "Inline", true)
.AddField("Field 2", "Not Inline", false); .AddField("Field 2", "Not Inline", false);
Assert.Equal(100, e.Length); Assert.Equal(100, e.Length);
@@ -263,11 +263,11 @@ namespace Discord
var e = new EmbedBuilder() var e = new EmbedBuilder()
.WithFooter(x => .WithFooter(x =>
{ {
x.IconUrl = url;
x.Text = name;
x.IconUrl = Url;
x.Text = Name;
}); });
Assert.Equal(url, e.Footer.IconUrl);
Assert.Equal(name, e.Footer.Text);
Assert.Equal(Url, e.Footer.IconUrl);
Assert.Equal(Name, e.Footer.Text);
} }


/// <summary> /// <summary>
@@ -278,13 +278,13 @@ namespace Discord
{ {
var footer = new EmbedFooterBuilder() var footer = new EmbedFooterBuilder()
{ {
IconUrl = url,
Text = name
IconUrl = Url,
Text = Name
}; };
var e = new EmbedBuilder() var e = new EmbedBuilder()
.WithFooter(footer); .WithFooter(footer);
Assert.Equal(url, e.Footer.IconUrl);
Assert.Equal(name, e.Footer.Text);
Assert.Equal(Url, e.Footer.IconUrl);
Assert.Equal(Name, e.Footer.Text);
// use the property // use the property
e = new EmbedBuilder e = new EmbedBuilder
{ {
@@ -301,9 +301,9 @@ namespace Discord
public void WithFooter_Strings() public void WithFooter_Strings()
{ {
var e = new EmbedBuilder() var e = new EmbedBuilder()
.WithFooter(name, url);
Assert.Equal(url, e.Footer.IconUrl);
Assert.Equal(name, e.Footer.Text);
.WithFooter(Name, Url);
Assert.Equal(Url, e.Footer.IconUrl);
Assert.Equal(Name, e.Footer.Text);
} }


/// <summary> /// <summary>
@@ -313,10 +313,10 @@ namespace Discord
public void EmbedFooterBuilder() public void EmbedFooterBuilder()
{ {
var footer = new EmbedFooterBuilder() var footer = new EmbedFooterBuilder()
.WithIconUrl(url)
.WithText(name);
Assert.Equal(url, footer.IconUrl);
Assert.Equal(name, footer.Text);
.WithIconUrl(Url)
.WithText(Name);
Assert.Equal(Url, footer.IconUrl);
Assert.Equal(Name, footer.Text);
} }
/// <summary> /// <summary>
/// Tests that invalid text throws an <see cref="ArgumentException"/>. /// Tests that invalid text throws an <see cref="ArgumentException"/>.


Loading…
Cancel
Save