Ejemplo n.º 1
0
        public async Task Run(TestCtx ctx)
        {
            var hostA = ctx.HostA;
            var hostB = ctx.HostB;

            await Task.WhenAll(
                Setup(hostA),
                Setup(hostB));

            await ctx.ConnectFrom(Host.A);

            await hostB.ChannelRecv(0, amount);

            await hostA.ChannelXmit(0, amount);

            var durationMs = await ctx.Pause(50000, _ => _.Trace.GetLastTraceItemChannelFor(Host.B, null)?.Channels[0]?.RecvPosition == amount);

            var xmitted   = ctx.Trace.GetLastTraceItemChannelFor(Host.B, null).Channels[0].RecvPosition;
            var speedKbps = xmitted / durationMs * 1000;
            var speedStr  = Utils.GetSizeAsString((long)speedKbps);
            var amountStr = Utils.GetSizeAsString(xmitted
                                                  );

            ctx.Log($@"Overall duration {durationMs} ms, amount {amountStr}, speed: {speedStr}/s");
            await ctx.HostB.ExpectClose();

            await ctx.HostA.Close();

            await ctx.Pause(100);

            await ctx.HostB.EnsureClosed();
        }
Ejemplo n.º 2
0
        public async Task Run(TestCtx ctx)
        {
            var hostA = ctx.HostA;
            var hostB = ctx.HostB;

            await Task.WhenAll(
                Setup(hostA),
                Setup(hostB));

            await ctx.ConnectFrom(Host.A);

            await ctx.Pause(100);

            await ctx.HostB.ExpectClose();

            await ctx.HostA.Close();

            await ctx.Pause(300);

            await ctx.HostB.EnsureClosed();
        }