public async Task ProcessDesiredPropertiesSubscriptionTest() { // Arrange string id = "d1"; RoutingEdgeHub edgeHub = await GetTestEdgeHub(); var cloudProxy = new Mock <ICloudProxy>(); cloudProxy.Setup(c => c.SetupDesiredPropertyUpdatesAsync()) .Returns(Task.CompletedTask); // Act await edgeHub.ProcessSubscription(id, Option.Some(cloudProxy.Object), DeviceSubscription.DesiredPropertyUpdates, true); // Assert cloudProxy.VerifyAll(); // Arrange cloudProxy = new Mock <ICloudProxy>(); cloudProxy.Setup(c => c.RemoveDesiredPropertyUpdatesAsync()) .Returns(Task.CompletedTask); // Act await edgeHub.ProcessSubscription(id, Option.Some(cloudProxy.Object), DeviceSubscription.DesiredPropertyUpdates, false); // Assert cloudProxy.VerifyAll(); }
public async Task ProcessMethodsSubscriptionTest() { // Arrange RoutingEdgeHub edgeHub = await GetTestEdgeHub(); var cloudProxy = new Mock <ICloudProxy>(); cloudProxy.Setup(c => c.SetupCallMethodAsync()) .Returns(Task.CompletedTask); // Act await edgeHub.ProcessSubscription(cloudProxy.Object, DeviceSubscription.Methods, true); // Assert cloudProxy.VerifyAll(); // Arrange cloudProxy = new Mock <ICloudProxy>(); cloudProxy.Setup(c => c.RemoveCallMethodAsync()) .Returns(Task.CompletedTask); // Act await edgeHub.ProcessSubscription(cloudProxy.Object, DeviceSubscription.Methods, false); // Assert cloudProxy.VerifyAll(); }
public async Task ProcessC2DSubscriptionTest() { // Arrange string id = "d1"; RoutingEdgeHub edgeHub = await GetTestEdgeHub(); var cloudProxy = new Mock <ICloudProxy>(); cloudProxy.Setup(c => c.StartListening()); // Act await edgeHub.ProcessSubscription(id, Option.Some(cloudProxy.Object), DeviceSubscription.C2D, true); // Assert cloudProxy.VerifyAll(); // Arrange cloudProxy = new Mock <ICloudProxy>(); // Act await edgeHub.ProcessSubscription(id, Option.Some(cloudProxy.Object), DeviceSubscription.C2D, false); // Assert cloudProxy.VerifyAll(); }
public async Task ProcessNoOpSubscriptionTest() { // Arrange RoutingEdgeHub edgeHub = await GetTestEdgeHub(); var cloudProxy = new Mock <ICloudProxy>(); // Act await edgeHub.ProcessSubscription(cloudProxy.Object, DeviceSubscription.ModuleMessages, true); await edgeHub.ProcessSubscription(cloudProxy.Object, DeviceSubscription.ModuleMessages, false); await edgeHub.ProcessSubscription(cloudProxy.Object, DeviceSubscription.TwinResponse, true); await edgeHub.ProcessSubscription(cloudProxy.Object, DeviceSubscription.TwinResponse, false); await edgeHub.ProcessSubscription(cloudProxy.Object, DeviceSubscription.Unknown, true); await edgeHub.ProcessSubscription(cloudProxy.Object, DeviceSubscription.Unknown, false); // Assert cloudProxy.VerifyAll(); }