diff --git a/src/AzureIoTHub.Portal.Client/Components/Devices/EditDevice.razor b/src/AzureIoTHub.Portal.Client/Components/Devices/EditDevice.razor index e00b6008f..1ba801cc9 100644 --- a/src/AzureIoTHub.Portal.Client/Components/Devices/EditDevice.razor +++ b/src/AzureIoTHub.Portal.Client/Components/Devices/EditDevice.razor @@ -330,7 +330,7 @@ { if (IsLoRa) { - + } @@ -339,7 +339,7 @@ { if (IsLoRa && Device != null && Commands != null) { - + } diff --git a/src/AzureIoTHub.Portal.Tests.Unit/Client/Components/Devices/EditDeviceTests.cs b/src/AzureIoTHub.Portal.Tests.Unit/Client/Components/Devices/EditDeviceTests.cs index adb25a721..b4adaff25 100644 --- a/src/AzureIoTHub.Portal.Tests.Unit/Client/Components/Devices/EditDeviceTests.cs +++ b/src/AzureIoTHub.Portal.Tests.Unit/Client/Components/Devices/EditDeviceTests.cs @@ -14,7 +14,9 @@ namespace AzureIoTHub.Portal.Tests.Unit.Client.Components.Devices using AzureIoTHub.Portal.Client.Models; using AzureIoTHub.Portal.Client.Services; using AzureIoTHub.Portal.Models.v10; + using AzureIoTHub.Portal.Models.v10.LoRaWAN; using AzureIoTHub.Portal.Shared.Models; + using AzureIoTHub.Portal.Shared.Models.v1._0; using AzureIoTHub.Portal.Shared.Models.v10.Filters; using AzureIoTHub.Portal.Tests.Unit.UnitTests.Bases; using AzureIoTHub.Portal.Tests.Unit.UnitTests.Mocks; @@ -726,33 +728,36 @@ public async Task DisplayPropertiesRenderCorrectly() cut.WaitForAssertion(() => MockRepository.VerifyAll()); } - //[Test] - //public async Task DisplayCreateLoraDeviceComponentRenderCorrectly() - //{ - // // Arrange - // var mockDeviceModel = new DeviceModelDto - // { - // ModelId = Guid.NewGuid().ToString(), - // Description = Guid.NewGuid().ToString(), - // SupportLoRaFeatures = true, - // Name = Guid.NewGuid().ToString() - // }; - - // _ = this.mockDeviceTagSettingsClientService.Setup(service => service.GetDeviceTags()) - // .ReturnsAsync(new List()); - - // _ = this.mockLoRaWanDeviceModelsClientService - // .Setup(service => service.GetDeviceModel(It.IsAny())) - // .ReturnsAsync(new LoRaDeviceModelDto()); - - // var cut = RenderComponent(parameters => parameters.Add(p => p.context, CreateEditMode.Create)); - - // // Act - // await cut.Instance.ChangeModel(mockDeviceModel); - // _ = cut.WaitForElement("#tab-lorawan"); - - // // Assert - // cut.WaitForAssertion(() => cut.Find("#tab-lorawan").TextContent.Should().Be("LoRaWAN")); - //} + [Test] + public async Task DisplayCreateLoraDeviceComponentRenderCorrectly() + { + // Arrange + var mockDeviceModel = new DeviceModelDto + { + ModelId = Guid.NewGuid().ToString(), + Description = Guid.NewGuid().ToString(), + SupportLoRaFeatures = true, + Name = Guid.NewGuid().ToString() + }; + + _ = this.mockDeviceTagSettingsClientService.Setup(service => service.GetDeviceTags()) + .ReturnsAsync(new List()); + + _ = this.mockLoRaWanDeviceModelsClientService + .Setup(service => service.GetDeviceModel(It.IsAny())) + .ReturnsAsync(new LoRaDeviceModelDto()); + + _ = this.mockLoRaWanDeviceClientService.Setup(service => service.GetGatewayIdList()) + .ReturnsAsync(new LoRaGatewayIDList()); + + var cut = RenderComponent(parameters => parameters.Add(p => p.context, CreateEditMode.Create)); + + // Act + await cut.Instance.ChangeModel(mockDeviceModel); + cut.WaitForElement("div.mud-tooltip-root:nth-child(2) > div.mud-tab").Click(); + + // Assert + cut.WaitForAssertion(() => cut.Find("div.mud-tooltip-root:nth-child(2) > div.mud-tab").TextContent.Should().Be("LoRaWAN")); + } } }