< Summary

Class:Azure.Identity.ProcessService
Assembly:Azure.Identity
File(s):C:\Git\azure-sdk-for-net\sdk\identity\Azure.Identity\src\ProcessService.cs
Covered lines:17
Uncovered lines:4
Coverable lines:21
Total lines:53
Line coverage:80.9% (17 of 21)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Default()-100%100%
.ctor()-100%100%
Create(...)-100%100%
.ctor(...)-100%100%
get_HasExited()-0%100%
get_ExitCode()-100%100%
get_StandardOutput()-100%100%
get_StandardError()-100%100%
get_StartInfo()-100%100%
set_StartInfo(...)-0%100%
add_Exited(...)-100%100%
remove_Exited(...)-0%100%
Start()-100%100%
Kill()-0%100%
Dispose()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\identity\Azure.Identity\src\ProcessService.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Diagnostics;
 6using System.IO;
 7
 8namespace Azure.Identity
 9{
 10    internal class ProcessService : IProcessService
 11    {
 12212        public static IProcessService Default { get; } = new ProcessService();
 13
 414        private ProcessService() { }
 15
 816        public IProcess Create(ProcessStartInfo startInfo) => new ProcessWrapper(startInfo);
 17
 18        private class ProcessWrapper : IProcess
 19        {
 20            private readonly Process _process;
 21
 822            public ProcessWrapper(ProcessStartInfo processStartInfo)
 23            {
 824                _process = new Process
 825                {
 826                    StartInfo = processStartInfo,
 827                    EnableRaisingEvents = true
 828                };
 829            }
 30
 031            public bool HasExited => _process.HasExited;
 832            public int ExitCode => _process.ExitCode;
 433            public StreamReader StandardOutput => _process.StandardOutput;
 434            public StreamReader StandardError => _process.StandardError;
 35
 36            public ProcessStartInfo StartInfo
 37            {
 2438                get => _process.StartInfo;
 039                set => _process.StartInfo = value;
 40            }
 41
 42            public event EventHandler Exited
 43            {
 844                add => _process.Exited += value;
 045                remove => _process.Exited -= value;
 46            }
 47
 848            public void Start() => _process.Start();
 049            public void Kill() => _process.Kill();
 850            public void Dispose() => _process.Dispose();
 51        }
 52    }
 53}