Ejemplo n.º 1
0
        public void CallOperationUpdateArgument()
        {
            var o1 = new NotificationObject<string>()
            {
                Value1 = "Test",
                Value2 = "Te",
            };

            var op = new CallOperation<bool>(new OperationContext(),
                Expression.Call(
                    Expression.MakeMemberAccess(
                        Expression.Constant(o1),
                        typeof(NotificationObject<string>).GetProperty("Value1")),
                    typeof(string).GetMethod("StartsWith", new Type[] { typeof(string) }),
                    Expression.MakeMemberAccess(
                        Expression.Constant(o1),
                        typeof(NotificationObject<string>).GetProperty("Value2"))));
            Assert.IsTrue(op.Value);

            o1.Value2 = "st";
            Assert.IsFalse(op.Value);

            o1.Value2 = "Te";
            Assert.IsTrue(op.Value);
        }
Ejemplo n.º 2
0
        public void CallOperationUpdateArgument()
        {
            var o1 = new NotificationObject <string>()
            {
                Value1 = "Test",
                Value2 = "Te",
            };

            var op = new CallOperation <bool>(new OperationContext(),
                                              Expression.Call(
                                                  Expression.MakeMemberAccess(
                                                      Expression.Constant(o1),
                                                      typeof(NotificationObject <string>).GetProperty("Value1")),
                                                  typeof(string).GetMethod("StartsWith", new Type[] { typeof(string) }),
                                                  Expression.MakeMemberAccess(
                                                      Expression.Constant(o1),
                                                      typeof(NotificationObject <string>).GetProperty("Value2"))));

            Assert.IsTrue(op.Value);

            o1.Value2 = "st";
            Assert.IsFalse(op.Value);

            o1.Value2 = "Te";
            Assert.IsTrue(op.Value);
        }
Ejemplo n.º 3
0
 public void CallOperationRead()
 {
     var op = new CallOperation<bool>(new OperationContext(),
         Expression.Call(
             Expression.Constant("Test"),
             typeof(string).GetMethod("StartsWith", new Type[] { typeof(string) }),
             Expression.Constant("Te")));
     Assert.IsTrue(op.Value);
 }
Ejemplo n.º 4
0
        public void CallOperationRead()
        {
            var op = new CallOperation <bool>(new OperationContext(),
                                              Expression.Call(
                                                  Expression.Constant("Test"),
                                                  typeof(string).GetMethod("StartsWith", new Type[] { typeof(string) }),
                                                  Expression.Constant("Te")));

            Assert.IsTrue(op.Value);
        }
Ejemplo n.º 5
0
        private void ProcessDeferredOperations()
        {
            CallOperation operation = null;

            while (_defferedOperations.TryDequeue(out operation))
            {
                var localOperation = operation;
                var del            = new Action(localOperation.Execute);
                del.BeginInvoke(_deferredOperationCallback, del);
            }
        }