diff --git a/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeModels/EdgeModelDetailPageTest.cs b/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeModels/EdgeModelDetailPageTest.cs index 2ccba98ae..7d4f4e3b2 100644 --- a/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeModels/EdgeModelDetailPageTest.cs +++ b/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeModels/EdgeModelDetailPageTest.cs @@ -323,6 +323,33 @@ public void ClickOnShowSystemModuleDetailShouldShowDialog() cut.WaitForAssertion(() => MockRepository.VerifyAll()); } + [Test] + public void ClickOnShowSystemModuleDetailShouldShowDialogAndReturnIfAborted() + { + // Arrange + _ = SetupLoadEdgeModel(); + + var mockDialogReference = MockRepository.Create(); + _ = mockDialogReference.Setup(c => c.Result).ReturnsAsync(DialogResult.Cancel()); + + _ = this.mockDialogService + .Setup(c => c.Show(It.IsAny(), It.IsAny(), It.IsAny())) + .Returns(mockDialogReference.Object); + + // Act + var cut = RenderComponent(ComponentParameter.CreateParameter("ModelID", this.mockEdgeModleId)); + + cut.WaitForAssertion(() => Assert.AreEqual(1, cut.FindAll("#editSystModuleButton_edgeAgent").Count)); + var editEdgeAgentButton = cut.WaitForElement("#editSystModuleButton_edgeAgent"); + + cut.WaitForElement($"#{nameof(EdgeModelSystemModule.ImageUri)}").Change("image/test"); + + editEdgeAgentButton.Click(); + + // Assert + cut.WaitForAssertion(() => MockRepository.VerifyAll()); + } + [Test] public void DeleteAvatarShouldRemoveTheImage() {