/** * Sets up sequence for DeviceGroupsClient.GetDeviceGroupsAsync * that will return groups with different etags */ private void SetupSequenceForDeviceGroupsClientMock() { this.deviceGroupsClientMock.SetupSequence(x => x.GetDeviceGroupsAsync()) .Returns(Task.FromResult(TestHelperFunctions.CreateDeviceGroupListApiModel("etag1", "group1"))) .Returns(Task.FromResult(TestHelperFunctions.CreateDeviceGroupListApiModel("etag2", "group1"))) .Returns(Task.FromResult(TestHelperFunctions.CreateDeviceGroupListApiModel("etag3", "group1"))); }
public void VerifyGetGroupToDeviceMappingFailsAfter5Retries() { // Arrange this.SetupAllExceptionSequenceDevicesClientMock(); // Act Exception ex = Assert.Throws <AggregateException>(() => this.deviceGroupsClient.GetGroupToDevicesMappingAsync(TestHelperFunctions.CreateDeviceGroupListApiModel("etag", GROUP_ID)).Wait()); // Assert Assert.IsType <ExternalDependencyException>(ex.InnerException); TestHelperFunctions.VerifyWarningsLogged(this.logMock, 5); TestHelperFunctions.VerifyErrorsLogged(this.logMock, 1); }
public void VerifyGetGroupToDeviceMappingRetriesOnException() { // Arrange this.Setup4ExceptionSequenceDevicesClientMock(); // Act Dictionary <string, IEnumerable <string> > mapping = this.deviceGroupsClient.GetGroupToDevicesMappingAsync(TestHelperFunctions.CreateDeviceGroupListApiModel("etag", GROUP_ID)).Result; // Assert Assert.True(mapping.ContainsKey(GROUP_ID)); Assert.Equal(3, mapping[GROUP_ID].Count()); TestHelperFunctions.VerifyWarningsLogged(this.logMock, 4); TestHelperFunctions.VerifyErrorsLogged(this.logMock, 0); }
public void ReferenceDataWrittenWithEmptyMapping() { // Arrange Dictionary <string, IEnumerable <string> > deviceMapping = new Dictionary <string, IEnumerable <string> >(); // Act this.deviceGroupsWriter.ExportMapToReferenceDataAsync(deviceMapping, this.timestamp); // Assert this.VerifyFileWrapperMethods(deviceMapping); this.VerifyCloudStorageWrapperMethods(); TestHelperFunctions.VerifyErrorsLogged(this.logMock, 0); }
public void VerifyGetGroupToDeviceMappingEmptyList() { // Arrange this.SetUpDevicesClientMockEmptyList(); // Act Dictionary <string, IEnumerable <string> > mapping = this.deviceGroupsClient.GetGroupToDevicesMappingAsync(TestHelperFunctions.CreateDeviceGroupListApiModel("etag", GROUP_ID)).Result; // Assert Assert.Empty(mapping.Keys); TestHelperFunctions.VerifyWarningsLogged(this.logMock, 0); TestHelperFunctions.VerifyErrorsLogged(this.logMock, 0); }
public void VerifyDeviceEventProcessorUpdatesEventHubStatus() { // Arrange IEventHubStatus eventHubStatus = new EventHubStatus(); DeviceEventProcessor deviceEventProcessor = new DeviceEventProcessor(eventHubStatus, 60000, this.logMock.Object); EventData data = new EventData(new byte[0]); List <EventData> eventDataList = new List <EventData> { data }; // Act deviceEventProcessor.ProcessEventsAsync(null, eventDataList).Wait(TEST_TIMEOUT_MS); // Assert Assert.True(eventHubStatus.SeenChanges); TestHelperFunctions.VerifyErrorsLogged(this.logMock, 0); }
public void BasicReferenceDataIsWritten() { // Arrange var deviceMapping = new Dictionary <string, IEnumerable <string> > { ["group1"] = new[] { "device1", "device2", "device3" }, ["group2"] = new[] { "device6", "device4", "device5" } }; // Act this.deviceGroupsWriter.ExportMapToReferenceDataAsync(deviceMapping, this.timestamp); // Assert this.VerifyFileWrapperMethods(deviceMapping); this.VerifyCloudStorageWrapperMethods(); TestHelperFunctions.VerifyErrorsLogged(this.logMock, 0); }
/** * Verifies agent functionality, where agent ran "loops" times * and is expected to write to blob storage "expectedWrites" times * Verifies event hub processor is set up, and expected loops and * writes occur. */ private void VerifyEndToEndResults(int loops, int expectedWrites) { TestHelperFunctions.VerifyErrorsLogged(this.logMock, 0); this.eventProcessorHostWrapperMock.Verify(e => e.CreateEventProcessorHost( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once()); this.eventProcessorHostWrapperMock.Verify(e => e.RegisterEventProcessorFactoryAsync( It.IsAny <EventProcessorHost>(), this.eventProcessorFactory), Times.Once()); this.deviceGroupsClientMock.Verify(d => d.GetDeviceGroupsAsync(), Times.Exactly(loops)); this.deviceGroupsWriterMock.Verify(d => d.ExportMapToReferenceDataAsync( It.IsAny <Dictionary <string, IEnumerable <string> > >(), It.IsAny <DateTimeOffset>()), Times.Exactly(expectedWrites)); }
// Set up device group client to return dummy device group list that will not change private void SetupDeviceGroupsClientMock() { this.deviceGroupListApiModel = TestHelperFunctions.CreateDeviceGroupListApiModel("etag1", "groupid"); this.deviceGroupsClientMock.Setup(x => x.GetDeviceGroupsAsync()).Returns(Task.FromResult(this.deviceGroupListApiModel)); }
public IEnumerator TestScene2() { // The scene used here is set up in BuildSetupAndCleanup.cs yield return(TestHelperFunctions.RunFacilitatorSceneTest("SampleTestScene")); }
public IEnumerator InputExperienceRecenter() { yield return(TestHelperFunctions.RunFacilitatorSceneTest("InputExperienceRecenter")); }
public IEnumerator InputArrayForTracking() { yield return(TestHelperFunctions.RunFacilitatorSceneTest("InputArrayForTracking")); }
public IEnumerator NameManfSerial() { yield return(TestHelperFunctions.RunFacilitatorSceneTest("NameManfSerial")); }
public IEnumerator InputFeatureUsageTracking() { yield return(TestHelperFunctions.RunFacilitatorSceneTest("InputFeatureUsageTracking")); }
public IEnumerator InputFeatureUsageControls() { yield return(TestHelperFunctions.RunFacilitatorSceneTest("InputFeatureUsageControls")); }
public IEnumerator InputHaptics() { yield return(TestHelperFunctions.RunFacilitatorSceneTest("InputHaptics")); }