Skip to content

Commit

Permalink
Add unit test to GetDevicesConfigurations
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeaugrand committed Feb 28, 2022
1 parent 79eb0a1 commit 7294029
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private ConfigService CreateConfigsServices()
}

[Test]
public async Task GetAllConfigs_StateUnderTest_ExpectedBehavior()
public async Task GetIoTEdgeConfigs_Should_Return_Modules_Configurations()
{
// Arrange
var configsServices = this.CreateConfigsServices();
Expand All @@ -51,6 +51,33 @@ public async Task GetAllConfigs_StateUnderTest_ExpectedBehavior()
Assert.IsNotNull(result);
Assert.AreEqual(1, result.Count());
Assert.AreEqual("bbb", result.Single().Id);

this.mockRepository.VerifyAll();
}

[Test]
public async Task GetDevicesConfigs_Should_Return_DeviceTwin_Configurations()
{
// Arrange
var configsServices = this.CreateConfigsServices();
var iotEdgeConfiguration = new Configuration("bbb");

iotEdgeConfiguration.Content.ModulesContent.Add("test", new Dictionary<string, object>());
this.mockRegistryManager.Setup(c => c.GetConfigurationsAsync(It.Is<int>(x => x == 0)))
.ReturnsAsync(new[]
{
new Configuration("aaa"),
iotEdgeConfiguration
});

// Act
var result = await configsServices.GetDevicesConfigurations();

// Assert
Assert.IsNotNull(result);
Assert.AreEqual(1, result.Count());
Assert.AreEqual("aaa", result.Single().Id);

this.mockRepository.VerifyAll();
}

Expand Down

0 comments on commit 7294029

Please sign in to comment.