public SystemLoggerProviderTests()
        {
            var scriptOptions = new ScriptJobHostOptions
            {
                RootLogPath = Path.GetTempPath()
            };

            _options = new OptionsWrapper <ScriptJobHostOptions>(scriptOptions);

            var debugStateProvider = new Mock <IDebugStateProvider>(MockBehavior.Strict);

            debugStateProvider.Setup(p => p.InDiagnosticMode).Returns(() => _inDiagnosticMode);

            var appServiceOptions = new TestOptionsMonitor <AppServiceOptions>(new AppServiceOptions());

            _provider = new SystemLoggerProvider(_options, null, _environment, debugStateProvider.Object, null, appServiceOptions);
        }
        public void ProxyMetadata_WhenProxyFileChanges_IsRefreshed()
        {
            using (var tempDirectory = new TempDirectory())
            {
                var testProxiesPath = Path.Combine(Environment.CurrentDirectory, @"TestScripts\Proxies");
                var monitor         = new TestOptionsMonitor <ScriptApplicationHostOptions>(new ScriptApplicationHostOptions
                {
                    ScriptPath = tempDirectory.Path
                });

                var environment  = new TestEnvironment();
                var eventManager = new ScriptEventManager();

                var manager = new ProxyMetadataManager(monitor, environment, eventManager, NullLoggerFactory.Instance);

                // Get metadata before proxies exist
                ProxyMetadataInfo proxyMetadata1 = manager.ProxyMetadata;
                ProxyMetadataInfo proxyMetadata2 = manager.ProxyMetadata;

                Assert.True(proxyMetadata2.Functions.IsDefaultOrEmpty);
                Assert.Same(proxyMetadata1, proxyMetadata2);

                // Update our proxies definition
                FileUtility.CopyDirectory(testProxiesPath, tempDirectory.Path);

                // Simulate a file change notification
                eventManager.Publish(new FileEvent(EventSources.ScriptFiles,
                                                   new FileSystemEventArgs(WatcherChangeTypes.Changed, tempDirectory.Path, ScriptConstants.ProxyMetadataFileName)));

                ProxyMetadataInfo proxyMetadata3 = manager.ProxyMetadata;

                Assert.NotSame(proxyMetadata1, proxyMetadata3);

                Assert.Equal(16, proxyMetadata3.Functions.Length);
            }
        }