public void TestInvokePrivateMethod()
        {
            var configuration = GetConfiguration();
            var test          = new ActorTestKit <M3>(configuration: configuration);

            int result = (int)test.Invoke("Add", 3, 4);

            test.Assert(result == 7, $"Incorrect result '{result}'");

            result = (int)test.Invoke("Add", new Type[] { typeof(int), typeof(int) }, 3, 4);
            test.Assert(result == 7, $"Incorrect result '{result}'");
        }
        public async Task TestInvokePrivateAsyncMethod()
        {
            var configuration = GetConfiguration();
            var test          = new ActorTestKit <M4>(configuration: configuration);

            int result = (int)await test.InvokeAsync("AddAsync", 3, 4);

            test.Assert(result == 7, $"Incorrect result '{result}'");

            result = (int)await test.InvokeAsync("AddAsync", new Type[] { typeof(int), typeof(int) }, 3, 4);

            test.Assert(result == 7, $"Incorrect result '{result}'");
        }
        public async Task TestInvokeInternalAsyncMethod()
        {
            var configuration = GetConfiguration();
            var test          = new ActorTestKit <M2>(configuration: configuration);

            int result = await test.ActorInstance.AddAsync(3, 4);

            test.Assert(result == 7, $"Incorrect result '{result}'");
        }
        public void TestInvokeInternalMethod()
        {
            var configuration = GetConfiguration();
            var test          = new ActorTestKit <M1>(configuration: configuration);

            int result = test.ActorInstance.Add(3, 4);

            test.Assert(result == 7, $"Incorrect result '{result}'");
        }
示例#5
0
        public async Task TestClassEventHandlerWildcardOverride()
        {
            var configuration = GetConfiguration();
            var test          = new ActorTestKit <M3>(configuration: configuration);

            await test.StartActorAsync();

            await test.SendEventAsync(new E1());

            test.Assert(test.ActorInstance.Count == 1, "HandleWildCard was not called");
        }
示例#6
0
        public async Task TestPushPopTransition()
        {
            var configuration = GetConfiguration();
            var test          = new ActorTestKit <M4>(configuration: configuration);
            await test.StartActorAsync();

            await test.SendEventAsync(new E1());

            await test.SendEventAsync(new E2());

            test.AssertStateTransition("Init");
            test.Assert(test.ActorInstance.Count == 1, "Did not reach Final state");
        }
示例#7
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}'");
        }