2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-12-14 00:40:26 +00:00

test complete

This commit is contained in:
2025-11-08 12:36:22 +03:00
parent fc943c8a36
commit e2e4ac90bc
11 changed files with 238 additions and 121 deletions

View File

@@ -119,7 +119,7 @@ public partial class MyService
int MyPasscode = 2025;
public PropertyContext<int> Passcode
{
get => new ((sender) => sender.Session.AuthorizedAccount == "alice" ? MyPasscode : 0);
get => new((sender) => sender.Session.AuthorizedAccount == "alice" ? MyPasscode : 0);
set
{
if (value.Connection.Session.AuthorizedAccount != "alice")
@@ -141,7 +141,7 @@ public partial class MyService
[Export] public IRecord[] RecordsArray => new IRecord[] { new MyRecord() { Id = 22, Name = "Test", Score = 22.1 } };
[Export] public List<MyRecord> RecordsList => new() { new MyRecord() { Id = 22, Name = "Test", Score = 22.1 } };
//[Export] public IMyRecord myrecord { get; set; }
[Export] public IMyRecord myrecord { get; set; }
[Export] public MyResource[]? myResources;
@@ -160,7 +160,7 @@ public partial class MyService
public void InvokeEvents(string msg, InvocationContext context)
{
//if (context.Connection.Session.AuthorizedAccount != "Alice")
// throw new Exception("Only Alice is allowed.");
// throw new Exception("Only Alice is allowed.");
StringEvent?.Invoke(msg);
ArrayEvent?.Invoke(new object[] { DateTime.UtcNow, "Event", msg });

View File

@@ -184,6 +184,10 @@ namespace Test
await wh.Open();
//var sc = service.GetGenericRecord();
//var d = Codec.Compose(sc, Warehouse.Default, null);
// Start testing
TestClient(service);
}
@@ -216,9 +220,13 @@ namespace Test
});
dynamic remote = await con.Get("sys/service");
var gr = await remote.GetGenericRecord();
Console.WriteLine(gr);
//return;
Console.WriteLine("OK");
perodicTimer = new Timer(new TimerCallback(perodicTimerElapsed), remote, 0, 1000);
var pcall = await con.Call("Hello", "whats up ?", DateTime.UtcNow);
@@ -231,8 +239,6 @@ namespace Test
TestObjectProps(local, remote);
var gr = await remote.GetGenericRecord();
Console.WriteLine(gr);
var opt = await remote.Optional(new { a1 = 22, a2 = 33, a4 = "What?" });
Console.WriteLine(opt);