Tracks the contents and region of a code expression.
Beispiel #1
1
        public void Constructor_WhenGivenANullExpression_ThrowsException()
        {
            var start = new Cursor("OK");
            var end = start.Advance(2);
            var codeSpan = new CodeSpan("OK", start, end);

            Assert.That(() => new TypedExpression(codeSpan, null), Throws.InstanceOf<ArgumentNullException>());
        }
Beispiel #2
1
        public void ToString_WhenConstructedWithANullValue_ReturnsTheCodeVerbatim()
        {
            var start = new Cursor("OK");
            var end = start.Advance(2);
            var codeSpan = new CodeSpan("OK", start, end);

            Assert.That(codeSpan.ToString(), Is.EqualTo("OK"));
        }
Beispiel #3
1
        /// <summary>
        /// Initializes a new instance of the <see cref="AndCodeExpression"/> class.
        /// </summary>
        /// <param name="code">The code to execute for the assertion.</param>
        public AndCodeExpression(CodeSpan code)
        {
            if (code == null)
            {
                throw new ArgumentNullException(nameof(code));
            }

            this.Code = code;
        }
Beispiel #4
1
        /// <summary>
        /// Initializes a new instance of the <see cref="CodeExpression"/> class.
        /// </summary>
        /// <param name="codeSpan">The literal code to be contained by this expression.</param>
        /// <param name="codeType">The semantic usage of this expression.</param>
        public CodeExpression(CodeSpan codeSpan, CodeType codeType)
        {
            if (codeSpan == null)
            {
                throw new ArgumentNullException("codeSpan");
            }

            this.codeSpan = codeSpan;
            this.codeType = codeType;
        }
Beispiel #5
1
        /// <summary>
        /// Initializes a new instance of the <see cref="TypedExpression"/> class.
        /// </summary>
        /// <param name="type">The specific type of the wrapped expression.</param>
        /// <param name="expression">The wrapped expression.</param>
        public TypedExpression(CodeSpan type, Expression expression)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            this.Type = type;
            this.Expression = expression;
        }
Beispiel #6
1
        /// <summary>
        /// Initializes a new instance of the <see cref="TypedExpression"/> class.
        /// </summary>
        /// <param name="type">The specific type of the wrapped expression.</param>
        /// <param name="expression">The wrapped expression.</param>
        public TypedExpression(CodeSpan type, Expression expression)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            this.type = type;

            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            this.expression = expression;
        }
Beispiel #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NotCodeExpression"/> class.
        /// </summary>
        /// <param name="code">The code to execute for the negative assertion.</param>
        public NotCodeExpression(CodeSpan code)
        {
            if (code == null)
            {
                throw new ArgumentNullException(nameof(code));
            }

            this.Code = code;
        }
Beispiel #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CodeExpression"/> class.
        /// </summary>
        /// <param name="codeSpan">The literal code to be contained by this expression.</param>
        /// <param name="codeType">The semantic usage of this expression.</param>
        public CodeExpression(CodeSpan codeSpan, CodeType codeType)
        {
            if (codeSpan == null)
            {
                throw new ArgumentNullException(nameof(codeSpan));
            }

            this.CodeSpan = codeSpan;
            this.CodeType = codeType;
        }
Beispiel #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TypedExpression"/> class.
        /// </summary>
        /// <param name="type">The specific type of the wrapped expression.</param>
        /// <param name="expression">The wrapped expression.</param>
        public TypedExpression(CodeSpan type, Expression expression)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            this.Type       = type;
            this.Expression = expression;
        }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TypedExpression"/> class.
 /// </summary>
 /// <param name="type">The specific type of the wrapped expression.</param>
 /// <param name="expression">The wrapped expression.</param>
 public TypedExpression(CodeSpan type, Expression expression)
 {
     this.Type       = type ?? throw new ArgumentNullException(nameof(type));
     this.Expression = expression ?? throw new ArgumentNullException(nameof(expression));
 }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AndCodeExpression"/> class.
 /// </summary>
 /// <param name="code">The code to execute for the assertion.</param>
 public AndCodeExpression(CodeSpan code)
 {
     this.Code = code ?? throw new ArgumentNullException(nameof(code));
 }