Akka.Tests.Actor.Scheduler.DedicatedThreadScheduler_ActionScheduler_Cancellation_Tests.When_canceling_existing_running_repeaters_by_scheduling_the_cancellation_ahead_of_time_Then_their_future_actions_should_not_be_invoked C# (CSharp) Method

When_canceling_existing_running_repeaters_by_scheduling_the_cancellation_ahead_of_time_Then_their_future_actions_should_not_be_invoked() private method

        public void When_canceling_existing_running_repeaters_by_scheduling_the_cancellation_ahead_of_time_Then_their_future_actions_should_not_be_invoked()
        {
            // Prepare, set up actions to be fired
            IActionScheduler scheduler = new DedicatedThreadScheduler(Sys);

            var cancelableOdd = new Cancelable(scheduler);
            scheduler.ScheduleRepeatedly(1, 150, () => TestActor.Tell("Test"), cancelableOdd);
            cancelableOdd.CancelAfter(50);

            //Expect one message
            ExpectMsg("Test");

            //Validate that no messages were sent
            ExpectNoMsg(200);
        }