public void TriggerUnknownIsNopEvenWithErrors()
        {
            using var uut = new RequestCorrespondances();
            var outcome = uut.Trigger(0, null, "irrelevant");

            Assert.False(outcome);
        }
        public void TriggerUnknownIsNop()
        {
            using var uut = new RequestCorrespondances();
            var outcome = uut.Trigger(0, 123, null);

            Assert.False(outcome);
        }
        public void InvalidTrigger()
        {
            using var uut = new RequestCorrespondances();
            var req = uut.Request("nothing.really", Array.Empty <object>(), thing => thing as Gizmo ?? throw new InvalidCastException());

            Assert.Throws <NotImplementedException>(() => uut.Trigger(req.request.id, null, null));
        }
        public async Task SuccessfulYetFailingAsync()
        {
            using var uut = new RequestCorrespondances();
            var req  = uut.Request("nothing.really", Array.Empty <object>(), thing => thing as Gizmo ?? throw new InvalidCastException());
            var trig = uut.Trigger(req.request.id, 123, null);

            Assert.True(trig);
            await Assert.ThrowsAsync <InvalidCastException>(async() => await req.task);
        }
        async public Task ErroredAsync()
        {
            using var uut = new RequestCorrespondances();
            var req  = uut.Request("nothing.really", Array.Empty <object>(), thing => thing as Gizmo ?? throw new InvalidCastException());
            var trig = uut.Trigger(req.request.id, null, "gone wrong");

            Assert.True(trig);
            await Assert.ThrowsAsync <JsonRpc.FailedMethodException>(async() => await req.task);
        }
        async public Task SuccessfulAsync()
        {
            var resPayload = "abcd";

            using var uut = new RequestCorrespondances();
            var req  = uut.Request("nothing.really", Array.Empty <object>(), thing => thing as Gizmo ?? throw new InvalidCastException());
            var trig = uut.Trigger(req.request.id, new Gizmo()
            {
                payload = resPayload
            }, null);
            var result = await req.task;

            Assert.True(trig);
            Assert.Equal(resPayload, result.payload);
        }