Skip to content

Commit

Permalink
Add test and change name
Browse files Browse the repository at this point in the history
  • Loading branch information
varunpuranik authored and CIPop committed Oct 3, 2018
1 parent 594bfae commit 2705938
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
23 changes: 22 additions & 1 deletion e2e/test/IoTHubServiceProxyE2ETests.cs
Expand Up @@ -46,6 +46,27 @@ public async Task RegistryManager_AddAndRemoveDevice_WithProxy()
await RegistryManager_AddDevice(httpTransportSettings).ConfigureAwait(false);
}

[TestMethod]
public async Task RegistryManager_AddAndRemoveDeviceWithScope()
{
RegistryManager registryManager = RegistryManager.CreateFromConnectionString(ConnectionString);

var edgeDevice = new Device(Guid.NewGuid().ToString())
{
Capabilities = new DeviceCapabilities { IotEdge = true }
};
edgeDevice = await registryManager.AddDeviceAsync(edgeDevice).ConfigureAwait(false);

var leafDevice = new Device(Guid.NewGuid().ToString()) { Scope = edgeDevice.Scope };
Device receivedDevice = await registryManager.AddDeviceAsync(leafDevice).ConfigureAwait(false);

Assert.IsNotNull(receivedDevice);
Assert.AreEqual(leafDevice.Id, receivedDevice.Id);
Assert.AreEqual(leafDevice.Scope, receivedDevice.Scope);
await registryManager.RemoveDeviceAsync(leafDevice.Id).ConfigureAwait(false);
await registryManager.RemoveDeviceAsync(edgeDevice.Id).ConfigureAwait(false);
}

[TestMethod]
public async Task JobClient_ScheduleAndRunTwinJob_WithProxy()
{
Expand Down Expand Up @@ -91,7 +112,7 @@ private async Task JobClient_ScheduleAndRunTwinJob(HttpTransportSettings httpTra
JobResponse jobResponse = await jobClient.GetJobAsync(jobId).ConfigureAwait(false);
}

private Message ComposeD2CTestMessage(out string payload, out string p1Value)
private Message ComposeD2CTestMessage(out string payload, out string p1Value)
{
payload = Guid.NewGuid().ToString();
p1Value = Guid.NewGuid().ToString();
Expand Down
4 changes: 2 additions & 2 deletions iothub/service/src/Device.cs
Expand Up @@ -112,7 +112,7 @@ public string ETag
/// <summary>
/// Scope to which this device instance belongs to
/// </summary>
[JsonProperty(PropertyName = "securityScope", NullValueHandling = NullValueHandling.Ignore)]
public virtual string SecurityScope { get; set; }
[JsonProperty(PropertyName = "deviceScope", NullValueHandling = NullValueHandling.Ignore)]
public virtual string Scope { get; set; }
}
}

0 comments on commit 2705938

Please sign in to comment.