public async Task NodeBrowsePathStaticScalarMethodsTestAsync() { // Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { await GetTests(device, module, services).NodeBrowsePathStaticScalarMethodsTestAsync(); }); } }
public async Task NodeBrowseDataAccessFC1001Test1Async() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeBrowseDataAccessFC1001Test1Async(); }); } }
public async Task NodeBrowseContinuationTest1Async() { // Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { await GetTests(device, module, services).NodeBrowseContinuationTest1Async(); }); } }
public async Task NodeReadStaticScalarBooleanValueVariableTestAsync() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { await GetTests(device, module, services).NodeReadStaticScalarBooleanValueVariableTestAsync(); }); } }
public async Task HistoryReadInt64ValuesTest4Async() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { await GetTests(device, module, services).HistoryReadInt64ValuesTest4Async(); }); } }
public async Task NodeReadAllStaticArrayVariableNodeClassTest1Async() { // Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeReadAllStaticArrayVariableNodeClassTest1Async(); }); } }
public async Task NodeWriteStaticScalarUInt16ValueVariableTestAsync() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeWriteStaticScalarUInt16ValueVariableTestAsync(); }); } }
public async Task NodeMethodCallStaticScalarMethod3WithObjectPathAndMethodIdAndBrowsePathTestAsync() { // Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeMethodCallStaticScalarMethod3WithObjectPathAndMethodIdAndBrowsePathTestAsync(); }); } }
public async Task NodeMethodCallBoiler2ResetTestAsync() { // Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeMethodCallBoiler2ResetTestAsync(); }); } }
public async Task NodeReadAllStaticScalarVariableAccessLevelTest1Async() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeReadAllStaticScalarVariableAccessLevelTest1Async(); }); } }
public async Task NodeWriteStaticScalarQualifiedNameValueVariableTestAsync() { // Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { await GetTests(device, module, services).NodeWriteStaticScalarQualifiedNameValueVariableTestAsync(); }); } }
public async Task NodeReadDiagnosticsVerboseTestAsync() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeReadDiagnosticsVerboseTestAsync(); }); } }
public async Task NodeWriteStaticScalarBooleanValueVariableWithBrowsePathTest3() { // Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeWriteStaticScalarBooleanValueVariableWithBrowsePathTest3(); }); } }
public async Task NodeBrowseBoilersObjectsTest2Async() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeBrowseBoilersObjectsTest2Async(); }); } }
public async Task NodeBrowseDiagnosticsOperationsTestAsync() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { await GetTests(device, module, services).NodeBrowseDiagnosticsOperationsTestAsync(); }); } }
public async Task NodeMethodCallStaticScalarMethod1Test1Async() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeMethodCallStaticScalarMethod1Test1Async(); }); } }
public async Task NodeBrowseFirstInRootTest2Async() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { await GetTests(device, module, services).NodeBrowseFirstInRootTest2Async(); }); } }
public async Task NodeReadDataAccessMeasurementFloatValueTestAsync() { // Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { await GetTests(device, module, services).NodeReadDataAccessMeasurementFloatValueTestAsync(); }); } }
public async Task NodeReadStaticArrayBooleanValueVariableTestAsync() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeReadStaticArrayBooleanValueVariableTestAsync(); }); } }
public async Task NodeBrowseStaticArrayVariablesRawModeTestAsync() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { await GetTests(device, module, services).NodeBrowseStaticArrayVariablesRawModeTestAsync(); }); } }
public async Task NodeMethodMetadataStaticScalarMethod3WithBrowsePathTest2() { Skip.IfNot(_runAll); using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(Endpoint, async (endpoint, services) => { await GetTests(endpoint, services).NodeMethodMetadataStaticScalarMethod3WithBrowsePathTest2(); }); } }
public async Task TestGetSupervisor() { using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { // Setup var registry = services.Resolve <ISupervisorRegistry>(); // Act var supervisor = await registry.GetSupervisorAsync(SupervisorModelEx.CreateSupervisorId(device, module)); // Assert Assert.True(supervisor.Connected.Value); Assert.True(supervisor.OutOfSync.Value); }); } }
public async Task TestActivateDeactivate20Endpoints5TimesMultiThreaded() { using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { // Setup var supervisorId = SupervisorModelEx.CreateSupervisorId(device, module); var activation = services.Resolve <IActivationServices <EndpointRegistrationModel> >(); var hub = services.Resolve <IIoTHubTwinServices>(); for (var i = 0; i < 20; i++) { var twin = new EndpointInfoModel { Registration = new EndpointRegistrationModel { Endpoint = new EndpointModel { Url = "opc.tcp://test" }, SupervisorId = supervisorId }, ApplicationId = "uas" + i }.ToEndpointRegistration().ToDeviceTwin(); await hub.CreateAsync(twin); } var registry = services.Resolve <IEndpointRegistry>(); var endpoints = await registry.ListAllEndpointsAsync(); for (var i = 0; i < 5; i++) { await Task.WhenAll(endpoints.Select(ep => registry.ActivateEndpointAsync(ep.Registration.Id))); await Task.WhenAll(endpoints.Select(ep => registry.DeactivateEndpointAsync(ep.Registration.Id))); } var diagnostics = services.Resolve <ISupervisorDiagnostics>(); endpoints = await registry.ListAllEndpointsAsync(); var status = await diagnostics.GetSupervisorStatusAsync(supervisorId); // Assert Assert.Equal(device, status.DeviceId); Assert.Equal(module, status.ModuleId); Assert.Null(status.SiteId); Assert.Empty(status.Endpoints); Assert.True(endpoints.All(ep => ep.ActivationState == EndpointActivationState.Deactivated)); Assert.True(endpoints.All(ep => ep.EndpointState == null)); }); } }
public async Task TestActivateDeactivateEndpoint20Times() { using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { // Setup var supervisorId = SupervisorModelEx.CreateSupervisorId(device, module); var activation = services.Resolve <IActivationServices <EndpointRegistrationModel> >(); var hub = services.Resolve <IIoTHubTwinServices>(); var twin = new EndpointInfoModel { Registration = new EndpointRegistrationModel { Endpoint = new EndpointModel { Url = "opc.tcp://test" }, SupervisorId = supervisorId }, ApplicationId = "ua326029342304923" }.ToEndpointRegistration().ToDeviceTwin(); await hub.CreateAsync(twin); var registry = services.Resolve <IEndpointRegistry>(); var endpoints = await registry.ListAllEndpointsAsync(); var ep1 = endpoints.FirstOrDefault(); Assert.NotNull(ep1); for (var i = 0; i < 20; i++) { // Act await registry.ActivateEndpointAsync(ep1.Registration.Id); await registry.DeactivateEndpointAsync(ep1.Registration.Id); } var diagnostics = services.Resolve <ISupervisorDiagnostics>(); endpoints = await registry.ListAllEndpointsAsync(); var ep3 = endpoints.FirstOrDefault(); var status = await diagnostics.GetSupervisorStatusAsync(supervisorId); // Assert Assert.Equal(device, status.DeviceId); Assert.Equal(module, status.ModuleId); Assert.Null(status.SiteId); Assert.Empty(status.Endpoints); Assert.Equal(EndpointActivationState.Deactivated, ep3.ActivationState); Assert.Null(ep3.EndpointState); }); } }
public async Task TestGetSupervisorStatus() { using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { // Setup var diagnostics = services.Resolve <ISupervisorDiagnostics>(); // Act var status = await diagnostics.GetSupervisorStatusAsync(SupervisorModelEx.CreateSupervisorId(device, module)); // Assert Assert.Equal(status.DeviceId, device); Assert.Equal(status.ModuleId, module); Assert.Null(status.SiteId); Assert.Empty(status.Endpoints); }); } }
public async Task TestActivateEndpoint() { using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { // Setup var supervisorId = SupervisorModelEx.CreateSupervisorId(device, module); var activation = services.Resolve <IEndpointActivation>(); var hub = services.Resolve <IIoTHubTwinServices>(); var twin = new EndpointInfoModel { Registration = new EndpointRegistrationModel { Endpoint = new EndpointModel { Url = "opc.tcp://test" }, SupervisorId = supervisorId }, ApplicationId = "ua326029342304923" }.ToEndpointRegistration(_serializer).ToDeviceTwin(_serializer); await hub.CreateOrUpdateAsync(twin); var registry = services.Resolve <IEndpointRegistry>(); var endpoints = await registry.ListAllEndpointsAsync(); var ep1 = endpoints.FirstOrDefault(); Assert.NotNull(ep1); // Act await activation.ActivateEndpointAsync(ep1.Registration.Id); endpoints = await registry.ListAllEndpointsAsync(); var ep2 = endpoints.FirstOrDefault(); var diagnostics = services.Resolve <ISupervisorDiagnostics>(); var status = await diagnostics.GetSupervisorStatusAsync(supervisorId); // Assert Assert.Equal(device, status.DeviceId); Assert.Equal(module, status.ModuleId); Assert.Null(status.SiteId); Assert.Single(status.Endpoints); Assert.Equal(ep1.Registration.Id, status.Endpoints.Single().Id); Assert.Equal(EndpointActivationState.ActivatedAndConnected, status.Endpoints.Single().ActivationState); Assert.Equal(EndpointActivationState.ActivatedAndConnected, ep2.ActivationState); Assert.True( ep2.EndpointState == EndpointConnectivityState.Connecting || ep2.EndpointState == EndpointConnectivityState.NotReachable); }); } }
public async Task TestListSupervisors() { using (var harness = new TwinModuleFixture()) { await harness.RunTestAsync(async (device, module, services) => { // Setup var registry = services.Resolve <ISupervisorRegistry>(); // Act var supervisors = await registry.ListAllSupervisorsAsync(); // Assert Assert.Single(supervisors); Assert.True(supervisors.Single().Connected.Value); Assert.True(supervisors.Single().OutOfSync.Value); Assert.Equal(device, SupervisorModelEx.ParseDeviceId(supervisors.Single().Id, out var moduleId)); Assert.Equal(module, moduleId); }); } }