Tracks the contents and region of a code expression.
        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>());
        }
Exemple #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"));
        }
Exemple #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;
        }
        /// <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;
        }
Exemple #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;
        }
        /// <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;
        }
Exemple #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;
        }
Exemple #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;
        }
Exemple #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;
        }
Exemple #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));
 }
Exemple #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));
 }