Esempio n. 1
0
        public async Task TestReceiveEventStatement()
        {
            var configuration = GetConfiguration();
            var test          = new ActorTestKit <M1>(configuration: configuration);

            await test.StartActorAsync();

            test.AssertIsWaitingToReceiveEvent(true);

            await test.SendEventAsync(new E1());

            test.AssertIsWaitingToReceiveEvent(false);
            test.AssertInboxSize(0);
        }
Esempio n. 2
0
        public async Task TestHandleEventInStateMachine()
        {
            var result = new Result();

            var configuration = GetConfiguration();
            var test          = new ActorTestKit <M1>(configuration: configuration);

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

            await test.SendEventAsync(new E1());

            test.AssertInboxSize(0);
            test.Assert(result.Value == 1, $"Incorrect result '{result.Value}'");
        }
Esempio n. 3
0
        public async Task TestMultipleReceiveEventStatementsUnordered()
        {
            var configuration = GetConfiguration();
            var test          = new ActorTestKit <M2>(configuration: configuration);

            await test.StartActorAsync();

            test.AssertIsWaitingToReceiveEvent(true);

            await test.SendEventAsync(new E2());

            test.AssertIsWaitingToReceiveEvent(true);
            test.AssertInboxSize(1);

            await test.SendEventAsync(new E3());

            test.AssertIsWaitingToReceiveEvent(true);
            test.AssertInboxSize(2);

            await test.SendEventAsync(new E1());

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