Skip to content

Commit

Permalink
Test CreateEdgeModelShouldCreateEdgeModel
Browse files Browse the repository at this point in the history
  • Loading branch information
crib authored and hocinehacherouf committed Dec 21, 2022
1 parent 23e986f commit c9a47de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/AzureIoTHub.Portal.Server/Services/EdgeModelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task CreateEdgeModel(IoTEdgeModel edgeModel)
throw new ResourceAlreadyExistsException($"The edge model with id {edgeModel?.ModelId} already exists");
}

_ = this.deviceModelImageManager.SetDefaultImageToModel(edgeModel.ModelId);
_ = await this.deviceModelImageManager.SetDefaultImageToModel(edgeModel?.ModelId);

await SaveModuleCommands(edgeModel);
await this.configService.RollOutEdgeModelConfiguration(edgeModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public async Task CreateEdgeModelShouldCreateEdgeModel()
{
// Arrange
var edgeDeviceModel = Fixture.Create<IoTEdgeModel>();
var expectedImageUri = Fixture.Create<Uri>();

_ = this.mockEdgeDeviceModelRepository.Setup(x => x.GetByIdAsync(It.IsAny<string>()))
.ReturnsAsync((EdgeDeviceModel)null);
Expand All @@ -202,6 +203,10 @@ public async Task CreateEdgeModelShouldCreateEdgeModel()
_ = this.mockConfigService.Setup(x => x.RollOutEdgeModelConfiguration(It.IsAny<IoTEdgeModel>()))
.Returns(Task.CompletedTask);

_ = this.mockDeviceModelImageManager.Setup(manager =>
manager.SetDefaultImageToModel(It.IsAny<string>()))
.ReturnsAsync(expectedImageUri.ToString());

// Act
await this.edgeDeviceModelService.CreateEdgeModel(edgeDeviceModel);

Expand Down

0 comments on commit c9a47de

Please sign in to comment.