示例#1
0
        public async Task TestHandleMultipleEvents()
        {
            var result = new Result();

            var configuration = GetConfiguration();
            var test          = new MachineTestKit <M2>(configuration: configuration);

            await test.StartMachineAsync(new SetupEvent(result));

            await test.SendEventAsync(new E1());

            await test.SendEventAsync(new E2());

            await test.SendEventAsync(new E3());

            test.AssertInboxSize(0);
            test.Assert(result.Value == 6, $"Incorrect result '{result.Value}'");
        }
示例#2
0
        public async Task TestGotoStateTransitionAfterSend()
        {
            var configuration = GetConfiguration();
            var test          = new MachineTestKit <M2>(configuration: configuration);
            await test.StartMachineAsync();

            test.AssertStateTransition("Init");

            await test.SendEventAsync(new Message());

            test.AssertStateTransition("Final");
        }
        public async Task TestMultipleReceiveEventStatementsWithMultipleTypes()
        {
            var configuration = GetConfiguration();
            var test          = new MachineTestKit <M4>(configuration: configuration);

            await test.StartMachineAsync();

            test.AssertIsWaitingToReceiveEvent(true);

            await test.SendEventAsync(new E1());

            test.AssertIsWaitingToReceiveEvent(true);

            await test.SendEventAsync(new E2());

            test.AssertIsWaitingToReceiveEvent(true);

            await test.SendEventAsync(new E3());

            test.AssertIsWaitingToReceiveEvent(false);
            test.AssertInboxSize(0);
        }