Exemplo n.º 1
0
            private async Task InitOnEntry()
            {
                this.SendEvent(this.Id, UnitEvent.Instance);
                await AsyncProvider.DelayAsync(10).ConfigureAwait(false);

                this.SendEvent(this.Id, UnitEvent.Instance);
            }
Exemplo n.º 2
0
            protected override async Task OnInitializeAsync(Event initialEvent)
            {
                this.SendEvent(this.Id, UnitEvent.Instance);
                await AsyncProvider.DelayAsync(10).ConfigureAwait(false);

                this.SendEvent(this.Id, UnitEvent.Instance);
            }
Exemplo n.º 3
0
 public void TestDetectedUncontrolledDelay()
 {
     this.Test(async() =>
     {
         await AsyncProvider.DelayAsync(100);
     },
               configuration: this.GetConfiguration()
               .WithPartiallyControlledConcurrencyAllowed()
               .WithTestingIterations(10));
 }
Exemplo n.º 4
0
        public void TestFuzzingFallbackAfterUncontrolledDelay()
        {
            var configuration = this.GetConfiguration().
                                WithSystematicFuzzingFallbackEnabled(true).
                                WithTestingIterations(10);

            this.Test(async() =>
            {
                // This would fail during SCT due to uncontrolled concurrency,
                // but the fuzzing fallback mechanism should prevent it.
                await AsyncProvider.DelayAsync(1);
            },
                      configuration);
        }
Exemplo n.º 5
0
 public void TestDetectedUncontrolledDelay()
 {
     this.TestWithError(async() =>
     {
         await AsyncProvider.DelayAsync(100);
     },
                        configuration: GetConfiguration().WithTestingIterations(100),
                        errorChecker: (e) =>
     {
         string expectedMethodName = $"{typeof(AsyncProvider).FullName}.{nameof(AsyncProvider.DelayAsync)}";
         Assert.StartsWith($"Method '{expectedMethodName}' returned an uncontrolled task", e);
     },
                        replay: true);
 }
Exemplo n.º 6
0
 public void TestDetectedUncontrolledDelayWithNoPartialControl()
 {
     this.TestWithError(async() =>
     {
         await AsyncProvider.DelayAsync(100);
     },
                        configuration: this.GetConfiguration().WithTestingIterations(10),
                        errorChecker: (e) =>
     {
         var expectedMethodName = GetFullyQualifiedMethodName(typeof(AsyncProvider), nameof(AsyncProvider.DelayAsync));
         Assert.StartsWith($"Invoking '{expectedMethodName}' returned task", e);
     },
                        replay: true);
 }
Exemplo n.º 7
0
            private async Task DelayedRandomAsync()
            {
                await AsyncProvider.DelayAsync(10).ConfigureAwait(false);

                this.RandomBoolean();
            }