public CoolerDeviceTests()
 {
     _fixture = new Fixture();
     _initConfig = _fixture.Create<InitialDeviceConfig>();
     var loggerMock = new Mock<ILogger>();
     _transportMock = new Mock<ITransport>();
     var transportFactoryMock = new Mock<ITransportFactory>();
     transportFactoryMock.Setup(x => x.CreateTransport(It.IsNotNull<IDevice>())).Returns(_transportMock.Object);
     var telemetryFactoryMock = new Mock<ITelemetryFactory>();
     var configurationProviderMock = new Mock<IConfigurationProvider>();
     var coolerDeviceFactory = new CoolerDeviceFactory();
     _coolerDevice = coolerDeviceFactory.CreateDevice(loggerMock.Object, transportFactoryMock.Object,
         telemetryFactoryMock.Object, configurationProviderMock.Object, _initConfig) as CoolerDevice;
     loggerMock.Setup(x => x.LogInfo(It.IsAny<string>(), It.IsAny<object[]>()));
 }
        static void StartSimulator()
        {
            // Dependencies to inject into the Bulk Device Tester
            var logger = new TraceLogger();
            var configProvider = new ConfigurationProvider();
            var telemetryFactory = new CoolerTelemetryFactory(logger);

            var serializer = new JsonSerialize();
            var transportFactory = new IotHubTransportFactory(serializer, logger, configProvider);

            IVirtualDeviceStorage deviceStorage = null;
            var useConfigforDeviceList = Convert.ToBoolean(configProvider.GetConfigurationSettingValueOrDefault("UseConfigForDeviceList", "False"), CultureInfo.InvariantCulture);

            if (useConfigforDeviceList)
            {
                deviceStorage = new AppConfigRepository(configProvider, logger);
            }
            else
            {
                deviceStorage = new VirtualDeviceTableStorage(configProvider);
            }

            IDeviceFactory deviceFactory = new CoolerDeviceFactory();

            // Start Simulator
            Trace.TraceInformation("Starting Simulator");
            var tester = new BulkDeviceTester(transportFactory, logger, configProvider, telemetryFactory, deviceFactory, deviceStorage);
            Task.Run(() => tester.ProcessDevicesAsync(cancellationTokenSource.Token), cancellationTokenSource.Token);
        }
 public CoolerDeviceFactoryTests()
 {
     _coolerDeviceFactory = new CoolerDeviceFactory();
     _fixture = new Fixture();
 }