コード例 #1
0
        public void ThisExpression()
        {
            var e = new ThisExpression();

            Assert.IsTrue(e.IsTrivial);
            Assert.AreEqual("this", e.ToString());
        }
コード例 #2
0
        /// <summary>
        /// Outputs a user-friendly representation of this expression.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            var delimiter = "";

            switch (Delimiter)
            {
            case IdDelimiter.Dollar: delimiter = "$"; break;

            case IdDelimiter.Dot: delimiter = "."; break;

            case IdDelimiter.Hash: delimiter = "#"; break;

            case IdDelimiter.SingleArrow: delimiter = "->"; break;

            case IdDelimiter.Slash: delimiter = "/"; break;
            }
            return($"{ThisExpression.ToString()}{delimiter}{MemberName}");
        }
コード例 #3
0
        public void ThisExpressionProducesThis()
        {
            var expression = new ThisExpression();

            Assert.AreEqual("this;", expression.ToString());
        }
コード例 #4
0
        public void ThisExpressionProducesThis()
        {
            var expression = new ThisExpression();

            Assert.AreEqual("this;", expression.ToString());
        }