public DeviceGroupComponentTests() { Mock <IBlobStorageConfig> blobStorageConfigMock = new Mock <IBlobStorageConfig>(); this.SetupBlobStorageConfigMock(blobStorageConfigMock); Mock <IServicesConfig> servicesConfigMock = new Mock <IServicesConfig>(); servicesConfigMock.Setup(x => x.ConfigServiceUrl).Returns("serviceurl"); servicesConfigMock.Setup(x => x.InitialIotHubManagerRetryIntervalMs).Returns(0); servicesConfigMock.Setup(x => x.IotHubManagerRetryCount).Returns(5); servicesConfigMock.Setup(x => x.IotHubManagerRetryIntervalIncreaseFactor).Returns(2); this.logMock = new Mock <ILogger>(); this.logMock.Setup(x => x.Warn(It.IsAny <string>(), It.IsAny <Action>())); this.logMock.Setup(x => x.Error(It.IsAny <string>(), It.IsAny <Action>())); var httpClientMock = new Mock <IHttpClient>(); this.devicesClientMock = new Mock <IDevicesClient>(); this.fileWrapperMock = new Mock <IFileWrapper>(); this.fileWrapperMock.Setup(x => x.GetTempFileName()).Returns(TEMP_FILE_NAME); this.fileWrapperMock.Setup(x => x.Exists(It.IsAny <string>())).Returns(true); this.cloudStorageWrapperMock = new Mock <ICloudStorageWrapper>(); this.deviceGroupsClient = new DeviceGroupsClient( httpClientMock.Object, this.devicesClientMock.Object, servicesConfigMock.Object, this.logMock.Object, new ThreadWrapper()); this.timestamp = new DateTime(2018, 4, 20, 10, 0, 0); this.expectedBlobName = $"{this.timestamp.ToString(DATE_FORMAT)}/{this.timestamp.ToString(TIME_FORMAT)}/{FILE_NAME}"; this.expectedConnectionString = $"DefaultEndpointsProtocol=https;AccountName={ACCOUNT_NAME};AccountKey={ACCOUNT_KEY};EndpointSuffix={ENDPOINT_SUFFIX}"; var blobStorageHelper = new BlobStorageHelper( blobStorageConfigMock.Object, this.cloudStorageWrapperMock.Object, this.logMock.Object); this.deviceGroupsWriter = new DeviceGroupsWriter( blobStorageConfigMock.Object, blobStorageHelper, this.fileWrapperMock.Object, this.logMock.Object); }
public Agent( IDeviceGroupsWriter deviceGroupsWriter, IDeviceGroupsClient deviceGroupsClient, IEventProcessorHostWrapper eventProcessorHostWrapper, IEventProcessorFactory deviceEventProcessorFactory, IEventHubStatus eventHubStatus, IServicesConfig servicesConfig, IBlobStorageConfig blobStorageConfig, ILogger logger, IThreadWrapper thread) { this.log = logger; this.deviceGroupsWriter = deviceGroupsWriter; this.deviceGroupsClient = deviceGroupsClient; this.eventProcessorHostWrapper = eventProcessorHostWrapper; this.deviceEventProcessorFactory = deviceEventProcessorFactory; this.eventHubStatus = eventHubStatus; this.servicesConfig = servicesConfig; this.blobStorageConfig = blobStorageConfig; this.deviceGroupDefinitionDictionary = new Dictionary <string, string>(); this.thread = thread; }