Esempio n. 1
0
        protected override object ImportFromBoolean(ImportContext context, JsonReader reader)
        {
            Debug.Assert(context != null);
            Debug.Assert(reader != null);

            return(BooleanObject.Box(reader.ReadBoolean()));
        }
Esempio n. 2
0
        public void Evaluate_CanEvalBooleanExpressions(string input, bool expected)
        {
            IObject actual = this.subject.Evaluate(input, this.environment);

            Assert.NotNull(actual);
            BooleanObject intResult = this.AssertAndCast <BooleanObject>(actual);

            Assert.Equal(expected, intResult.Value);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a BooleanResponse object from its byte representation
        /// </summary>
        /// <param name="input">Byte representation of the object</param>
        public BooleanResponse(byte[] input)
        {
            if (input == null)
                return;

            booleanObject = BooleanObject.CreateBuilder().MergeFrom(input).Build();
            Console.WriteLine(booleanObject.Istrue);
            data = booleanObject.Istrue;
        }
Esempio n. 4
0
        /// <summary>
        /// Constructs an instance of the class with the specified parameters.
        /// </summary>
        /// <param name="args">The parameters passed to the constructor.</param>
        /// <returns>The created instance of the class.</returns>
        public override IScriptObject Construct(List <IScriptObject> args)
        {
            var ins = new BooleanObject();

            if (Constructor != null)
            {
                Constructor.Invoke(ins, args);
            }
            return(ins);
        }
Esempio n. 5
0
        /// <summary>
        /// Creates a BooleanResponse object from its byte representation
        /// </summary>
        /// <param name="input">Byte representation of the object</param>
        public BooleanResponse(byte[] input)
        {
            if (input == null)
            {
                return;
            }

            booleanObject = BooleanObject.CreateBuilder().MergeFrom(input).Build();
            Console.WriteLine(booleanObject.Istrue);
            data = booleanObject.Istrue;
        }
Esempio n. 6
0
        public void ObtainBoolean(string fragment, bool?expected)
        {
            /// 7.3.2 Boolean objects
            byte[]     bytes      = System.Text.UTF8Encoding.UTF8.GetBytes(fragment);
            Tokenizer  feed       = new Tokenizer(new MemoryStream(bytes));
            Objectizer objectizer = new Objectizer(feed);

            BooleanObject actual = (BooleanObject)objectizer.NextObject();

            Assert.Equal(expected, actual.Value);
        }
 protected override object ImportFromNumber(ImportContext context, JsonReader reader)
 {
     Debug.Assert(context != null);
     Debug.Assert(reader != null);
     try
     {
         return(BooleanObject.Box(reader.ReadNumber().ToInt64() != 0));
     }
     catch (FormatException innerException)
     {
         throw new JsonException($"The JSON Number {reader.Text} must be an integer to be convertible to System.Boolean.", innerException);
     }
 }
Esempio n. 8
0
        public override Task <BooleanObject> SetRolePermission(SetRolePermissionRequest request, ServerCallContext context)
        {
            var res = new BooleanObject();

            if (request.Has)
            {
                if (!_roleDao.ExistPermission(request.RoleId, request.PermissionCode))
                {
                    res.Body = _roleDao.AddRolePermission(request.RoleId, request.PermissionCode);
                }
            }
            else
            {
                res.Body = _roleDao.DeleteRolePermission(request.RoleId, request.PermissionCode);
            }

            return(Task.FromResult(res));
        }
Esempio n. 9
0
 public static double op_Addition(None x, [NotNull] BooleanObject y)
 {
     throw new NotImplementedException();
 }
Esempio n. 10
0
 protected override object ImportFromBoolean(ImportContext context, JsonReader reader)
 {
     return BooleanObject.Box(reader.ReadBoolean());
 }
Esempio n. 11
0
 public static double op_Addition(decimal x, BooleanObject y)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 protected override object ImportFromBoolean(ImportContext context, JsonReader reader)
 {
     return(Convert.ChangeType(BooleanObject.Box(reader.ReadBoolean()), OutputType));
 }
Esempio n. 13
0
 public static string op_Addition([NotNull] BooleanObject x, [NotNull] ConcatString y)
 {
     throw new NotImplementedException();
 }
Esempio n. 14
0
 public static double op_Addition([NotNull] BooleanObject x, [NotNull] UnDefined y)
 {
     throw new NotImplementedException();
 }
Esempio n. 15
0
 public static ConcatString op_Addition(ConcatString x, BooleanObject y)
 {
     return(new ConcatString(x, Convert.ToString(y)));
 }
Esempio n. 16
0
 public BooleanValueEval(BooleanObject booleanObject)
 {
     BooleanObject = booleanObject;
 }
Esempio n. 17
0
        // vvv http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.10
        public bool isCloseConnectionIndicated() 
        {
            if (null != _closeConnectionIndicated)
            {
                return _closeConnectionIndicated.booleanValue();
            }

            if (!_headers.ContainsKey("connection"))
            {
                _closeConnectionIndicated = BooleanObject.FALSE;
            }
            else
            {
                if ("close".Equals(_headers["connection"]))
                {
                    _closeConnectionIndicated = BooleanObject.TRUE;
                }
                else
                {
                    _closeConnectionIndicated = BooleanObject.FALSE;
                }
            }
            return _closeConnectionIndicated.booleanValue();
        }