Skip to content

Commit

Permalink
Bug/1403_-_When creating a new edge device, the model image is not di…
Browse files Browse the repository at this point in the history
…splayed (#1413)

* Reorganize projects directories (#1393)

* resolve #1403

* add new test to verify that the model image is displayed on the page

* delete useless assignement

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>
  • Loading branch information
Sben65 and kbeaugrand authored Oct 25, 2022
1 parent ff78d79 commit 3db396a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</MudCardHeader>
<MudCardContent>
<div class="d-flex justify-center mb-4">
<MudAvatar Image="@EdgeDevice.ImageUrl?.ToString()" Style="height:100px; width: auto; border-radius: 0; background: transparent " />
<MudAvatar id="@(nameof(IoTEdgeDevice.ImageUrl))" Image="@EdgeDevice.ImageUrl?.ToString()" Style="height:100px; width: auto; border-radius: 0; background: transparent " />
</div>
</MudCardContent>
</MudCard>
Expand Down Expand Up @@ -305,10 +305,21 @@
{
this._edgeModel = edgeModel;

this.EdgeDevice = new IoTEdgeDevice()
{
DeviceId = this.EdgeDevice.DeviceId,
DeviceName = this.EdgeDevice.DeviceName,
ModelId = edgeModel?.ModelId,
ImageUrl = edgeModel?.ImageUrl,
Tags = this.EdgeDevice.Tags,
IsEnabled = this.EdgeDevice.IsEnabled
};

if (edgeModel == null || string.IsNullOrWhiteSpace(edgeModel.ModelId))
{
return;
}

}
catch (ProblemDetailsException exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,5 +297,37 @@ public async Task ClickOnSaveAndAddNewShouldCreateEdgeDeviceAndResetCreateEdgeDe
cut.WaitForAssertion(() => cut.Find($"#{nameof(IoTEdgeDevice.DeviceId)}").TextContent.Should().BeEmpty());
cut.WaitForAssertion(() => this.mockNavigationManager.Uri.Should().NotEndWith("/edge/devices"));
}

[Test]
public async Task ChangeEdgeModelShouldDisplayModelImage()
{
// Arrange
var edgeModel = new IoTEdgeModelListItem()
{
ModelId = Guid.NewGuid().ToString(),
Name = Guid.NewGuid().ToString(),
Description = Guid.NewGuid().ToString(),
ImageUrl = Fixture.Create<Uri>()
};

_ = this.mockIEdgeModelClientService.Setup(x => x.GetIoTEdgeModelList())
.ReturnsAsync(new List<IoTEdgeModelListItem>() { edgeModel });

_ = this.mockDeviceTagSettingsClientService.Setup(x => x.GetDeviceTags())
.ReturnsAsync(new List<DeviceTagDto>()
{
new DeviceTagDto(){ Name = "tag01", Required = true}
});

var cut = RenderComponent<CreateEdgeDevicePage>();

var ModelImageElement = cut.WaitForElement($"#{nameof(IoTEdgeDevice.ImageUrl)}");

await cut.Instance.ChangeModel(edgeModel);

// Assert
Assert.IsFalse(string.IsNullOrEmpty(ModelImageElement.InnerHtml));
cut.WaitForAssertion(() => MockRepository.VerifyAll());
}
}
}

0 comments on commit 3db396a

Please sign in to comment.