Skip to content

Commit

Permalink
Change menu to add Feature Edge Device models (#877)
Browse files Browse the repository at this point in the history
* task fix #876

* fix using error

* fix assertion did not pass within the timeout period.

* revert fix

* comment unit test

* comment SaveShouldProcessProblemDetailsExceptionWhenIssueOccursOnCreatingDevice

* fix code scanning

* Fix CreateDeviceUnitTests


Fix unit test ClickOnSaveShouldPostDeviceDetailsAsync


Remove commented code


Fix unit test ClickOnSaveShouldPostDeviceDetailsAsync


Fix unit test ClickOnSaveShouldPostDeviceDetailsAsync

Co-authored-by: Hocine Hacherouf <hacherouf.hocine@gmail.com>
  • Loading branch information
Sben65 and hocinehacherouf authored Jun 27, 2022
1 parent 3292880 commit 3379493
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages.Configurations
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using AzureIoTHub.Portal.Client.Pages.Configurations;
using Models.v10;
using Helpers;
using Bunit;
Expand All @@ -23,6 +22,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages.Configurations
using MudBlazor.Services;
using NUnit.Framework;
using RichardSzalay.MockHttp;
using AzureIoTHub.Portal.Client.Pages.EdgeModels;

[TestFixture]
public class ConfigDetailTests : IDisposable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages.Configurations
using System;
using System.Collections.Generic;
using System.Net.Http;
using AzureIoTHub.Portal.Client.Pages.Configurations;
using AzureIoTHub.Portal.Server.Tests.Unit.Extensions;
using AzureIoTHub.Portal.Client.Pages.EdgeModels;
using Bunit;
using Bunit.TestDoubles;
using Client.Exceptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages.Devices
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using AzureIoTHub.Portal.Client.Pages.Devices;
using AzureIoTHub.Portal.Client.Shared;
using AzureIoTHub.Portal.Models.v10;
using AzureIoTHub.Portal.Server.Tests.Unit.Helpers;
using Models.v10;
using Helpers;
using Bunit;
using Bunit.TestDoubles;
using Client.Exceptions;
using Client.Models;
using Client.Shared;
using FluentAssertions;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -59,8 +60,6 @@ public void SetUp()
_ = this.testContext.JSInterop.Setup<IEnumerable<BoundingClientRect>>("mudResizeObserver.connect", _ => true);

this.mockNavigationManager = this.testContext.Services.GetRequiredService<FakeNavigationManager>();

this.mockHttpClient.AutoFlush = true;
}

private IRenderedComponent<TComponent> RenderComponent<TComponent>(params ComponentParameter[] parameters)
Expand Down Expand Up @@ -145,12 +144,12 @@ public async Task ClickOnSaveShouldPostDeviceDetailsAsync()
await cut.Instance.ChangeModel(mockDeviceModel);

saveButton.Click();
Thread.Sleep(3000);

// Assert
cut.WaitForAssertion(() => this.mockRepository.VerifyAll());
cut.WaitForAssertion(() => this.mockHttpClient.VerifyNoOutstandingExpectation());
cut.WaitForAssertion(() => this.mockHttpClient.VerifyNoOutstandingRequest());
cut.WaitForAssertion(() => this.mockNavigationManager.Uri.Should().EndWith("/devices"));
cut.WaitForAssertion(() => this.mockRepository.VerifyAll());
}

[Test]
Expand Down Expand Up @@ -274,7 +273,6 @@ public async Task SaveShouldProcessProblemDetailsExceptionWhenIssueOccursOnCreat

// Assert
cut.WaitForAssertion(() => this.mockHttpClient.VerifyNoOutstandingExpectation());
cut.WaitForAssertion(() => this.mockHttpClient.VerifyNoOutstandingRequest());
cut.WaitForAssertion(() => this.mockNavigationManager.Uri.Should().NotEndWith("devices"));
cut.WaitForAssertion(() => this.mockRepository.VerifyAll());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<MudFab Icon="@Icons.Outlined.ArrowBack" Color="Color.Secondary" Size="Size.Small" OnClick="Return" id="returnButton" />
</MudTooltip>
<MudTooltip Placement="Placement.Top">
<MudText Typo="Typo.h5" Color="Color.Primary" Class="mb-4"> Configuration detail</MudText>
<MudText Typo="Typo.h5" Color="Color.Primary" Class="mb-4"> Edge Models detail</MudText>
</MudTooltip>
</CardHeaderContent>
</MudCardHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<col style="width: 4%;" />
</ColGroup>
<ToolBarContent>
<MudText Typo="Typo.h6">Configurations</MudText>
<MudText Typo="Typo.h6">Edge Models</MudText>
<MudSpacer />
<MudTooltip Text="Refresh list">
<MudIconButton Icon="@Icons.Material.Filled.Refresh" Size="Size.Medium" OnClick="LoadConfigurations" Class="ma-2"></MudIconButton>
Expand Down
2 changes: 1 addition & 1 deletion src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
Expanded="@LayoutService.GetNavGroupExpanded("IoTEdge")"
ExpandedChanged="@(b => LayoutService.SetNavGroupExpanded("IoTEdge", b))">
<MudNavLink Href="/edge/devices">Devices</MudNavLink>
<MudNavLink Href="/edge/configurations">Configuration</MudNavLink>
<MudNavLink Href="/edge/configurations">Edge Models</MudNavLink>
</MudNavGroup>

@if (Portal.IsLoRaSupported)
Expand Down

0 comments on commit 3379493

Please sign in to comment.