From 06d913983d70a216a9a5d0abb81d65b4b632fe3d Mon Sep 17 00:00:00 2001 From: Roberto Alves Date: Fri, 20 Oct 2023 10:13:33 +0100 Subject: [PATCH] Update CherryPickRunnerTestFixture.cs --- .../CherryPick/CherryPickRunnerTestFixture.cs | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/COMET.Web.Common.Tests/Utilities/CherryPick/CherryPickRunnerTestFixture.cs b/COMET.Web.Common.Tests/Utilities/CherryPick/CherryPickRunnerTestFixture.cs index 1b460b8f..f3bb06ec 100644 --- a/COMET.Web.Common.Tests/Utilities/CherryPick/CherryPickRunnerTestFixture.cs +++ b/COMET.Web.Common.Tests/Utilities/CherryPick/CherryPickRunnerTestFixture.cs @@ -28,7 +28,8 @@ namespace COMET.Web.Common.Tests.Utilities.CherryPick { using NUnit.Framework; - using CDP4Common.SiteDirectoryData; + using SiteDirectory = CDP4Common.SiteDirectoryData.SiteDirectory; + using CDP4Common.DTO; using COMET.Web.Common.Services.SessionManagement; using COMET.Web.Common.Utilities.CherryPick; @@ -61,12 +62,24 @@ public async Task VerifyProperties() var propertyInfo = typeof(CherryPickRunner).GetProperty("IsCherryPicking", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public); propertyInfo?.SetValue(this.viewModel, true, null); - await this.viewModel.RunCherryPick(); - this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny>>()), Times.Never); + await this.viewModel.RunCherryPickAsync(); + this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny>>()), Times.Never); propertyInfo?.SetValue(this.viewModel, false, null); - await this.viewModel.RunCherryPick(); - this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny>>()), Times.Once); + await this.viewModel.RunCherryPickAsync(); + this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny>>()), Times.Once); + + this.needCherryPickedData.Invocations.Clear(); + + var engineeringModelId = Guid.NewGuid(); + var iterationId = Guid.NewGuid(); + propertyInfo?.SetValue(this.viewModel, true, null); + await this.viewModel.RunSingleCherryPickAsync(engineeringModelId, iterationId); + this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny>>()), Times.Never); + + propertyInfo?.SetValue(this.viewModel, false, null); + await this.viewModel.RunSingleCherryPickAsync(engineeringModelId, iterationId); + this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny>>()), Times.Once); } } }