private static DisposableValue <Mock <IotHubLogger> > SetupProviderAndLogger(LoRaLoggerConfiguration configuration, Lazy <Task <ModuleClient> >?moduleClientFactory = null) { var optionsMonitor = new Mock <IOptionsMonitor <LoRaLoggerConfiguration> >(); optionsMonitor.Setup(om => om.CurrentValue).Returns(configuration); optionsMonitor.Setup(om => om.OnChange(It.IsAny <Action <LoRaLoggerConfiguration, string> >())).Returns(NullDisposable.Instance); var mcf = moduleClientFactory ?? new Lazy <Task <ModuleClient> >(Task.FromResult((ModuleClient)null !)); var provider = new IotHubLoggerProvider(optionsMonitor.Object, mcf); return(new DisposableValue <Mock <IotHubLogger> >(new Mock <IotHubLogger>(provider, mcf), provider)); }
public IotHubLogger(IotHubLoggerProvider iotHubLoggerProvider, Lazy <Task <ModuleClient> > moduleClientFactory) { this.iotHubLoggerProvider = iotHubLoggerProvider; this.moduleClientFactory = moduleClientFactory; }