< Summary

Information
Class: Renci.SshNet.ExpectAction
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\ExpectAction.cs
Line coverage
66%
Covered lines: 16
Uncovered lines: 8
Coverable lines: 24
Total lines: 65
Line coverage: 66.6%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Expect()100%1100%
get_Action()100%1100%
.ctor(...)50%463.63%
.ctor(...)50%463.63%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\ExpectAction.cs

#LineLine coverage
 1using System;
 2using System.Text.RegularExpressions;
 3
 4namespace Renci.SshNet
 5{
 6    /// <summary>
 7    /// Specifies behavior for expected expression.
 8    /// </summary>
 9    public class ExpectAction
 10    {
 11        /// <summary>
 12        /// Gets the expected regular expression.
 13        /// </summary>
 1514        public Regex Expect { get; private set; }
 15
 16        /// <summary>
 17        /// Gets the action to perform when expected expression is found.
 18        /// </summary>
 1219        public Action<string> Action { get; private set; }
 20
 21        /// <summary>
 22        /// Initializes a new instance of the <see cref="ExpectAction"/> class.
 23        /// </summary>
 24        /// <param name="expect">The expect regular expression.</param>
 25        /// <param name="action">The action to perform.</param>
 26        /// <exception cref="ArgumentNullException"><paramref name="expect"/> or <paramref name="action"/> is <see langw
 327        public ExpectAction(Regex expect, Action<string> action)
 328        {
 329            if (expect is null)
 030            {
 031                throw new ArgumentNullException(nameof(expect));
 32            }
 33
 334            if (action is null)
 035            {
 036                throw new ArgumentNullException(nameof(action));
 37            }
 38
 339            Expect = expect;
 340            Action = action;
 341        }
 42
 43        /// <summary>
 44        /// Initializes a new instance of the <see cref="ExpectAction"/> class.
 45        /// </summary>
 46        /// <param name="expect">The expect expression.</param>
 47        /// <param name="action">The action to perform.</param>
 48        /// <exception cref="ArgumentNullException"><paramref name="expect"/> or <paramref name="action"/> is <see langw
 349        public ExpectAction(string expect, Action<string> action)
 350        {
 351            if (expect is null)
 052            {
 053                throw new ArgumentNullException(nameof(expect));
 54            }
 55
 356            if (action is null)
 057            {
 058                throw new ArgumentNullException(nameof(action));
 59            }
 60
 361            Expect = new Regex(Regex.Escape(expect));
 362            Action = action;
 363        }
 64    }
 65}