Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sben65 committed Sep 8, 2022
1 parent 1c94c7c commit faa78e8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ public async Task GetWithIdShouldReturnDeviceConfiguration()
// Assert
Assert.IsNotNull(response);

//Assert.IsAssignableFrom<OkObjectResult>(response.Result);

//if (response.Result is OkObjectResult okObjectResult)
//{
// Assert.IsNotNull(okObjectResult.Value);
// Assert.IsAssignableFrom<DeviceConfig>(okObjectResult.Value);
//}
//else
//{
// Assert.Fail("Cannot inspect the result.");
//}
Assert.IsAssignableFrom<OkObjectResult>(response.Result);

if (response.Result is OkObjectResult okObjectResult)
{
Assert.IsNotNull(okObjectResult.Value);
Assert.IsAssignableFrom<DeviceConfig>(okObjectResult.Value);
}
else
{
Assert.Fail("Cannot inspect the result.");
}

this.mockRepository.VerifyAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public async Task<IEnumerable<ConfigListItem>> Get()
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult<DeviceConfig>> Get(string configurationId)
{
return await this.deviceConfigurationsService.GetDeviceConfigurationAsync(configurationId);
return Ok(await this.deviceConfigurationsService.GetDeviceConfigurationAsync(configurationId));
}

[HttpGet("{configurationId}/metrics", Name = "GET Device configuration metrics")]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult<ConfigurationMetrics>> GetConfigurationMetrics(string configurationId)
{
return await this.deviceConfigurationsService.GetConfigurationMetricsAsync(configurationId);
return Ok(await this.deviceConfigurationsService.GetConfigurationMetricsAsync(configurationId));
}

[HttpPost(Name = "POST Create Device configuration")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ public async Task<DeviceConfig> GetDeviceConfigurationAsync(string configuration
{
var configItem = await this.configService.GetConfigItem(configurationId);

var deviceConfig = ConfigHelper.CreateDeviceConfig(configItem);

return deviceConfig;
return ConfigHelper.CreateDeviceConfig(configItem);
}
catch (InvalidOperationException e)
{
Expand Down
1 change: 1 addition & 0 deletions src/AzureIoTHub.Portal/Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void ConfigureServices(IServiceCollection services)
_ = services.AddTransient<ILoRaWANConcentratorService, LoRaWANConcentratorService>();
_ = services.AddTransient<IEdgeDevicesService, EdgeDevicesService>();
_ = services.AddTransient<IDevicePropertyService, DevicePropertyService>();
_ = services.AddTransient<IDeviceConfigurationsService, DeviceConfigurationsService>();

_ = services.AddMudServices();

Expand Down

0 comments on commit faa78e8

Please sign in to comment.