Exemplo n.º 1
0
        public async Task SkipNextCommandSkips()
        {
            using var mock = AutoMock.GetLoose();
            var context = mock.Mock <IUpgradeContext>().Object;

            var stepTitle = "Test step!";
            var step      = new TestUpgradeStep(stepTitle);
            var command   = new SkipNextCommand(step);

            // Initialize step
            Assert.Equal(UpgradeStepStatus.Unknown, step.Status);
            await step.InitializeAsync(context, CancellationToken.None).ConfigureAwait(false);

            Assert.Equal(UpgradeStepStatus.Incomplete, step.Status);
            Assert.Equal(BuildBreakRisk.Low, step.Risk);

            // Apply command
            Assert.True(await command.ExecuteAsync(context, CancellationToken.None).ConfigureAwait(false));

            // Confirm command text and step state are as expected
            Assert.Equal($"Skip next step ({stepTitle})", command.CommandText);
            Assert.Equal(0, step.ApplicationCount);
            Assert.Equal(UpgradeStepStatus.Skipped, step.Status);
            Assert.Equal(BuildBreakRisk.Low, step.Risk);
            Assert.Equal("Step skipped", step.StatusDetails);
        }
Exemplo n.º 2
0
 private async void Center_OnInteractionCompleted(object sender, EventArgs e)
 {
     if (Math.Abs(Center.OffsetX) > .55 * ActualWidth)
     {
         if (Center.OffsetX < 0)
         {
             SkipToNext(() =>
             {
                 PreviousUri = CurrentUri;
                 CurrentUri  = NextUri;
                 NextUri     = null;
             });
             SkipNextCommand?.Execute(null);
         }
         else if (Center.OffsetX > 0)
         {
             SkipToPrevious(() =>
             {
                 NextUri     = CurrentUri;
                 CurrentUri  = PreviousUri;
                 PreviousUri = null;
             });
             SkipPreviousCommand?.Execute(null);
         }
     }
     else
     {
         await Center.ResetOffsetAsync();
     }
 }