Skip to content

Commit

Permalink
Update CherryPickRunnerTestFixture.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbware committed Oct 20, 2023
1 parent 12ad6c9 commit 06d9139
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<IEnumerable<IEnumerable<CDP4Common.DTO.Thing>>>()), Times.Never);
await this.viewModel.RunCherryPickAsync();
this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny<IEnumerable<IEnumerable<Thing>>>()), Times.Never);

propertyInfo?.SetValue(this.viewModel, false, null);
await this.viewModel.RunCherryPick();
this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny<IEnumerable<IEnumerable<CDP4Common.DTO.Thing>>>()), Times.Once);
await this.viewModel.RunCherryPickAsync();
this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny<IEnumerable<IEnumerable<Thing>>>()), 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<IEnumerable<IEnumerable<Thing>>>()), Times.Never);

propertyInfo?.SetValue(this.viewModel, false, null);
await this.viewModel.RunSingleCherryPickAsync(engineeringModelId, iterationId);
this.needCherryPickedData.Verify(x => x.ProcessCherryPickedData(Moq.It.IsAny<IEnumerable<IEnumerable<Thing>>>()), Times.Once);
}
}
}

0 comments on commit 06d9139

Please sign in to comment.