Skip to content

Commit

Permalink
Added Enum sample to test project
Browse files Browse the repository at this point in the history
  • Loading branch information
galvesribeiro committed Oct 31, 2019
1 parent 5ce8685 commit f0b1c79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions test/Blazor.Extensions.SignalR.Test.Client/DemoData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,14 @@ public class DemoData

[JsonPropertyName("bool")]
public bool Bool { get; set; }

[JsonPropertyName("enumData")]
public EnumType EnumData { get; set; }
}

public enum EnumType : uint
{
A,
B
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void DumpData(params DemoData[] arr)
{
foreach (var demoData in arr)
{
this.Messages.Add($"demoData.id({demoData.Id}) | demoData.Data({demoData.Data}) | demoData.DateTime({demoData.DateTime}) | demoData.DecimalData({demoData.DecimalData}) | demoData.Bool({demoData.Bool})");
this.Messages.Add($"demoData.id({demoData.Id}) | demoData.Data({demoData.Data}) | demoData.DateTime({demoData.DateTime}) | demoData.DecimalData({demoData.DecimalData}) | demoData.Bool({demoData.Bool}) | demoData.EnumData({demoData.EnumData})");
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/Blazor.Extensions.SignalR.Test.Server/Hubs/ChatHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class ChatHub : Hub
{
public async Task DoSomething()
{
await this.Clients.All.SendAsync("DemoMethodObject", new DemoData { Id = 1, Data = "Demo Data", DateTime = DateTime.UtcNow, DecimalData = 1.98M, Bool = true });
await this.Clients.All.SendAsync("DemoMethodObject", new DemoData { Id = 1, Data = "Demo Data", DateTime = DateTime.UtcNow, DecimalData = 1.98M, Bool = true, EnumData = EnumType.A });
await this.Clients.All.SendAsync("DemoMethodList",
Enumerable.Range(1, 10).Select(x => new DemoData { Id = x, Data = $"Demo Data #{x}", DateTime = DateTime.UtcNow, DecimalData = 2.2M, Bool = true }).ToList());
Enumerable.Range(1, 10).Select(x => new DemoData { Id = x, Data = $"Demo Data #{x}", DateTime = DateTime.UtcNow, DecimalData = 2.2M, Bool = true, EnumData = EnumType.B }).ToList());
}

public override async Task OnConnectedAsync()
Expand Down

0 comments on commit f0b1c79

Please sign in to comment.