Skip to content

Commit

Permalink
Not working (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
divinci authored and galvesribeiro committed Oct 30, 2019
1 parent a27bb96 commit 027bdea
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
7 changes: 6 additions & 1 deletion test/Blazor.Extensions.SignalR.Test.Client/DemoData.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
using System;

namespace Blazor.Extensions.SignalR.Test.Client
{
public class DemoData
{
public int Id { get; set; }
public long Id { get; set; }
public string Data { get; set; }
public decimal DecimalData { get; set; }
public DateTime DateTime { get; set; }
public bool Bool { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,18 @@ private async Task<string> GetJwtToken(string userId)
private Task Handle(object msg)
{
Console.WriteLine(msg);
this.Messages.Add(msg.ToString());
if(msg is DemoData[])
{
var demoDatas = msg as DemoData[];
foreach(var demoData in demoDatas)
{
this.Messages.Add($"demoData.id({demoData.Id}) | demoData.Data({demoData.Data}) | demoData.DateTime({demoData.DateTime}) | demoData.DecimalData({demoData.DecimalData}) | demoData.Bool({demoData.Bool})");
}
}
else
{
this.Messages.Add(msg.ToString());
}
this.StateHasChanged();
return Task.CompletedTask;
}
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 @@ -43,8 +43,8 @@ public Task DoMultipleArgs()

public Task DoMultipleArgsComplex()
{
return this.Clients.All.SendAsync("DemoMultiArgs2", new DemoData { Id = 1, Data = "Demo Data" },
Enumerable.Range(1, 10).Select(x => new DemoData { Id = x, Data = $"Demo Data #{x}" }).ToList());
return this.Clients.All.SendAsync("DemoMultiArgs2", new DemoData { Id = 1, Data = "Demo Data", DecimalData = 0.000000001M, DateTime = DateTime.UtcNow, Bool = true },
Enumerable.Range(1, 10).Select(x => new DemoData { Id = x, Data = $"Demo Data #{x}", DecimalData = x * 0.000000001M , DateTime = DateTime.UtcNow.AddSeconds(-x), Bool = (x % 2 == 0) }).ToList());
}

public Task Send(string message)
Expand Down

0 comments on commit 027bdea

Please sign in to comment.