• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SystemDiagnostics类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SystemDiagnostics的典型用法代码示例。如果您正苦于以下问题:C# SystemDiagnostics类的具体用法?C# SystemDiagnostics怎么用?C# SystemDiagnostics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SystemDiagnostics类属于命名空间,在下文中一共展示了SystemDiagnostics类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddEnvironmentForTest

        public void AddEnvironmentForTest()
        {
            var notifications = new List<TestCompletedNotification>();
            var builder = new Mock<IReportBuilder>();
            var diagnostics = new SystemDiagnostics((p, s) => { }, null);
            var storage = new ActiveTestStorage(diagnostics);

            var testId = 10;
            storage.Add(testId, builder.Object, notifications);

            var environment = new Mock<IActiveEnvironment>();
            {
                environment.Setup(e => e.Environment)
                    .Returns("a");
            }

            storage.AddEnvironmentForTest(testId, environment.Object);

            Assert.That(
                storage.EnvironmentsForTest(testId),
                Is.EquivalentTo(
                    new List<IActiveEnvironment>
                        {
                            environment.Object
                        }));
        }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:26,代码来源:ActiveTestStorageTest.cs


示例2: FileWatcherBasedPackageUploader

        /// <summary>
        /// Initializes a new instance of the <see cref="FileWatcherBasedPackageUploader"/> class.
        /// </summary>
        /// <param name="packageQueue">The object that queues packages that need to be processed.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="diagnostics">The object providing the diagnostics methods for the application.</param>
        internal FileWatcherBasedPackageUploader(
            IQueueSymbolPackages packageQueue,
            IConfiguration configuration,
            SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => packageQueue);
                Lokad.Enforce.Argument(() => configuration);
                Lokad.Enforce.Argument(() => diagnostics);

                Lokad.Enforce.With<ArgumentException>(
                    configuration.HasValueFor(CoreConfigurationKeys.s_UploadPath),
                    Resources.Exceptions_Messages_MissingConfigurationValue_WithKey,
                    CoreConfigurationKeys.s_UploadPath);
            }

            m_Queue = packageQueue;
            m_Diagnostics = diagnostics;

            var uploadPath = configuration.Value<string>(CoreConfigurationKeys.s_UploadPath);
            m_Watcher = new FileSystemWatcher
            {
                Path = uploadPath,
                Filter = "*.symbols.nupkg",
                EnableRaisingEvents = false,
                NotifyFilter = NotifyFilters.FileName | NotifyFilters.CreationTime,
            };

            m_Watcher.Created += HandleFileCreated;
        }
开发者ID:pvandervelde,项目名称:nAnicitus,代码行数:36,代码来源:FileWatcherBasedPackageUploader.cs


示例3: CreateWithEmptyInstallDirectory

        public void CreateWithEmptyInstallDirectory()
        {
            RetrieveFileDataForTestStep testFileLocation = index => @"c:\a\b";
            UploadReportFilesForTestStep uploader = (index, upload) => { };

            var fileSystem = new System.IO.Abstractions.TestingHelpers.MockFileSystem(
                new Dictionary<string, System.IO.Abstractions.TestingHelpers.MockFileData>
                    {
                        { @"c:\d\e\f.ps1", new System.IO.Abstractions.TestingHelpers.MockFileData("throw 'FAIL'") }
                    });

            var sectionBuilder = new Mock<ITestSectionBuilder>();
            var diagnostics = new SystemDiagnostics((p, s) => { }, null);
            var installer = new XCopyDeployTestStepProcessor(
               testFileLocation,
               uploader,
               diagnostics,
               fileSystem,
               sectionBuilder.Object);

            var data = new XCopyTestStep
                {
                    pk_TestStepId = 1,
                    Order = 2,
                    Destination = @"c:\d\e",
                };

            var result = installer.Process(data, new List<InputParameter>());
            Assert.AreEqual(TestExecutionState.Passed, result);
        }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:30,代码来源:XCopyDeployTestStepProcessorTest.cs


示例4: InstallWithPowershellFile

        public void InstallWithPowershellFile()
        {
            RetrieveFileDataForTestStep testFileLocation = index => @"c:\a\b";
            UploadReportFilesForTestStep uploader = (index, upload) => { };

            var fileSystem = new MockFileSystem(
                new Dictionary<string, MockFileData>
                    {
                        { @"c:\a\b\c.ps1", new MockFileData("Out-Host -InputObject 'hello word'") }
                    });

            var sectionBuilder = new Mock<ITestSectionBuilder>();
            var diagnostics = new SystemDiagnostics((p, s) => { }, null);
            var installer = new ScriptExecuteTestStepProcessor(
               testFileLocation,
               uploader,
               diagnostics,
               fileSystem,
               sectionBuilder.Object);

            var data = new ScriptExecuteTestStep
            {
                pk_TestStepId = 1,
                Order = 2,
                ScriptLanguage = ScriptLanguage.Powershell,
            };

            var result = installer.Process(data, new List<InputParameter>());
            Assert.AreEqual(TestExecutionState.Passed, result);
        }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:30,代码来源:ScriptExecuteTestStepProcessorTest.cs


示例5: RegisterNotification

        public void RegisterNotification()
        {
            NotificationName notification = null;
            Action<INotificationArguments> action = null;

            var service = new Mock<IUserInterfaceService>();
            {
                service.Setup(s => s.RegisterNotification(It.IsAny<NotificationName>(), It.IsAny<Action<INotificationArguments>>()))
                    .Callback<NotificationName, Action<INotificationArguments>>(
                        (n, o) =>
                            {
                                notification = n;
                                action = o;
                            });
            }

            var notificationNames = new Mock<INotificationNameConstants>();
            {
                notificationNames.Setup(n => n.SystemShuttingDown)
                    .Returns(new NotificationName("a"));
            }

            var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null);
            var facade = new ApplicationFacade(service.Object, notificationNames.Object, systemDiagnostics);

            var name = new NotificationName("bla");
            Action<INotificationArguments> callback = o => { };
            facade.RegisterNotification(name, callback);

            Assert.AreSame(name, notification);
            Assert.AreSame(callback, action);
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:32,代码来源:ApplicationFacadeTest.cs


示例6: Add

        public void Add()
        {
            var notifications = new List<TestCompletedNotification>
                {
                    new FileBasedTestCompletedNotification("b"),
                };

            var report = new Mock<IReport>();
            var builder = new Mock<IReportBuilder>();
            {
                builder.Setup(b => b.Build())
                    .Returns(report.Object);
            }

            var diagnostics = new SystemDiagnostics((p, s) => { }, null);
            var storage = new ActiveTestStorage(diagnostics);

            var testId = 10;
            storage.Add(testId, builder.Object, notifications);

            Assert.That(
                storage.NotificationsFor(testId),
                Is.EquivalentTo(notifications));
            Assert.AreSame(report.Object, storage.ReportFor(testId));
        }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:25,代码来源:ActiveTestStorageTest.cs


示例7: CreateStorageDirectory

        private static void CreateStorageDirectory(IFileSystem fileSystem, string storageDirectory, SystemDiagnostics diagnostics)
        {
            if (fileSystem.Directory.Exists(storageDirectory))
            {
                diagnostics.Log(
                    LevelToLog.Info,
                    ExecutorConstants.LogPrefix,
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.Log_Messages_RemovingStorageDirectory_WithDirectory,
                        storageDirectory));

                fileSystem.Directory.Delete(storageDirectory, true);
            }

            if (!fileSystem.Directory.Exists(storageDirectory))
            {
                diagnostics.Log(
                    LevelToLog.Debug,
                    ExecutorConstants.LogPrefix,
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.Log_Messages_CreatingStorageDirectory_WithDirectory,
                        storageDirectory));

                fileSystem.Directory.CreateDirectory(storageDirectory);
            }
        }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:28,代码来源:Program.cs


示例8: NucleiBasedTraceWriter

        /// <summary>
        /// Initializes a new instance of the <see cref="NucleiBasedTraceWriter"/> class.
        /// </summary>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public NucleiBasedTraceWriter(SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Diagnostics = diagnostics;
        }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:15,代码来源:NucleiBasedTraceWriter.cs


示例9: PrismToDiagnosticsLogger

        /// <summary>
        /// Initializes a new instance of the <see cref="PrismToDiagnosticsLogger"/> class.
        /// </summary>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public PrismToDiagnosticsLogger(SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Diagnostics = diagnostics;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:15,代码来源:PrismToDiagnosticsLogger.cs


示例10: KernelService

        /// <summary>
        /// Initializes a new instance of the <see cref="KernelService"/> class.
        /// </summary>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        protected KernelService(SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Diagnostics = diagnostics;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:15,代码来源:KernelService.cs


示例11: LogReporter

        /// <summary>
        /// Initializes a new instance of the <see cref="LogReporter"/> class.
        /// </summary>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public LogReporter(SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Diagnostics = diagnostics;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:15,代码来源:LogReporter.cs


示例12: ActiveTestStorage

        /// <summary>
        /// Initializes a new instance of the <see cref="ActiveTestStorage"/> class.
        /// </summary>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public ActiveTestStorage(SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Diagnostics = diagnostics;
        }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:15,代码来源:ActiveTestStorage.cs


示例13: LogForwardingPipe

        /// <summary>
        /// Initializes a new instance of the <see cref="LogForwardingPipe"/> class.
        /// </summary>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public LogForwardingPipe(SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Diagnostics = diagnostics;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:15,代码来源:LogForwardingPipe.cs


示例14: WhiteLogRedirector

        /// <summary>
        /// Initializes a new instance of the <see cref="WhiteLogRedirector"/> class.
        /// </summary>
        /// <param name="name">The name for the logger.</param>
        /// <param name="level">The default log level.</param>
        /// <param name="diagnostics">The object that provides the logging for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public WhiteLogRedirector(string name, LoggerLevel level, SystemDiagnostics diagnostics)
            : base(name, level)
        {
            {
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Diagnostics = diagnostics;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:18,代码来源:WhiteLogRedirector.cs


示例15: FeedbackIconView

        /// <summary>
        /// Initializes a new instance of the <see cref="FeedbackIconView"/> class.
        /// </summary>
        /// <param name="systemDiagnostics">The object that provides the diagnostics methods for the system.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />.
        /// </exception>
        public FeedbackIconView(SystemDiagnostics systemDiagnostics)
            : this()
        {
            {
                Lokad.Enforce.Argument(() => systemDiagnostics);
            }

            m_Diagnostics = systemDiagnostics;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:16,代码来源:FeedbackIconView.xaml.cs


示例16: PhysicalMachineEnvironmentActivator

 /// <summary>
 /// Initializes a new instance of the <see cref="PhysicalMachineEnvironmentActivator"/> class.
 /// </summary>
 /// <param name="configuration">The object that stores all the configuration values for the application.</param>
 /// <param name="commands">The object that stores all the command sets that were received from remote endpoints.</param>
 /// <param name="notifications">The object that provides notifications from remote endpoints.</param>
 /// <param name="disconnection">The delegate used to notify the communication system of the disconnection of an endpoint.</param>
 /// <param name="uploads">The object that tracks the files available for upload.</param>
 /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="configuration"/> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="commands"/> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="notifications"/> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="disconnection"/> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="uploads"/> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
 /// </exception>
 public PhysicalMachineEnvironmentActivator(
     IConfiguration configuration,
     ISendCommandsToRemoteEndpoints commands,
     INotifyOfRemoteEndpointEvents notifications,
     ManualEndpointDisconnection disconnection,
     IStoreUploads uploads,
     SystemDiagnostics diagnostics)
     : base(configuration, commands, notifications, disconnection, uploads, diagnostics)
 {
 }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:37,代码来源:PhysicalMachineEnvironmentActivator.cs


示例17: CoreProxy

        /// <summary>
        /// Initializes a new instance of the <see cref="CoreProxy"/> class.
        /// </summary>
        /// <param name="owner">The <see cref="Kernel"/> to which this proxy is linked.</param>
        /// <param name="diagnostics">The object that handles the diagnostics for the application.</param>
        /// <param name="scheduler">The scheduler that is used to run tasks.</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="owner"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="diagnostics"/> is <see langword="null"/>.
        /// </exception>
        public CoreProxy(IKernel owner, SystemDiagnostics diagnostics, TaskScheduler scheduler = null)
            : base(diagnostics)
        {
            {
                Enforce.Argument(() => owner);
            }

            m_Owner = owner;
            m_Scheduler = scheduler ?? TaskScheduler.Default;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:22,代码来源:CoreProxy.cs


示例18: TestStepAdditionalReportFilesController

        /// <summary>
        /// Initializes a new instance of the <see cref="TestStepAdditionalReportFilesController"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public TestStepAdditionalReportFilesController(IProvideTestingContext context, SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => context);
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Context = context;
            m_Diagnostics = diagnostics;
        }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:21,代码来源:TestStepAdditionalReportFilesController.cs


示例19: TestStepParameterController

        /// <summary>
        /// Initializes a new instance of the <see cref="TestStepParameterController"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="context"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public TestStepParameterController(IProvideTestingContext context, SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => context);
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Context = context;
            m_Diagnostics = diagnostics;
        }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:21,代码来源:TestStepParameterController.cs


示例20: DatasetActivator

        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetActivator"/> class.
        /// </summary>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the system.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public DatasetActivator(SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Diagnostics = diagnostics;

            LoadDatasetDependencies();
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:17,代码来源:DatasetActivator.cs



注:本文中的SystemDiagnostics类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SystemId类代码示例发布时间:2022-05-24
下一篇:
C# Xml.XmlWriterSettings类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap