Пример #1
0
 public void CanGetDelegate()
 {
     var obj = new MockStructure();
     var suffix = new NoArgsSuffix<Encapsulation.Structure>(() => obj );
     var del = suffix.Get();
     Assert.IsNotNull(del);
 }
Пример #2
0
 public void CanGetDelegate()
 {
     var obj = new object();
     var suffix = new NoArgsSuffix<object>(() => obj );
     var del = suffix.Get();
     Assert.IsNotNull(del);
     var delegateAsDelegate = del as Delegate;
     Assert.IsNotNull(delegateAsDelegate);
 }
Пример #3
0
 public void CanGetDelegateValue()
 {
     var obj = new object();
     var suffix = new NoArgsSuffix<object>(() => obj );
     var del = suffix.Get();
     Assert.IsNotNull(del);
     var delegateAsDelegate = del as Delegate;
     Assert.IsNotNull(delegateAsDelegate);
     var value = delegateAsDelegate.DynamicInvoke();
     Assert.IsNotNull(value);
     Assert.AreSame(obj,value);
 }
Пример #4
0
 public void CanGetDelegateValueType()
 {
     const int VALUE = 12345;
     var suffix = new NoArgsSuffix<object>(() => VALUE );
     var del = suffix.Get();
     Assert.IsNotNull(del);
     var delegateAsDelegate = del as Delegate;
     Assert.IsNotNull(delegateAsDelegate);
     var value = delegateAsDelegate.DynamicInvoke();
     Assert.IsNotNull(value);
     Assert.IsInstanceOf<int>(value);
     Assert.AreEqual(VALUE,value);
 }
Пример #5
0
        public void CanGetDelegateValue()
        {
            var obj = new MockStructure();
            var suffix = new NoArgsSuffix<Encapsulation.Structure>(() => obj );
            var del = suffix.Get();
            Assert.IsNotNull(del);

            cpu.PushStack(null);  // dummy variable for ReverseStackArgs to pop
            cpu.PushStack(new KOSArgMarkerType());
            del.Invoke(cpu);

            var value = del.Value;
            Assert.IsNotNull(value);
            Assert.AreSame(obj,value);
        }
Пример #6
0
        public void CanGetDelegateValueType()
        {
            const int VALUE = 12345;
            var suffix = new NoArgsSuffix<Encapsulation.Structure>(() => ScalarValue.Create(VALUE));
            var del = suffix.Get();
            Assert.IsNotNull(del);

            cpu.PushStack(null);  // dummy variable for ReverseStackArgs to pop
            cpu.PushStack(new KOSArgMarkerType());
            del.Invoke(cpu);

            var value = del.Value;
            Assert.IsNotNull(value);
            Assert.IsInstanceOf<ScalarValue>(value);
            Assert.AreEqual(ScalarValue.Create(VALUE), value);
        }
Пример #7
0
 public void CanCreate()
 {
     var suffix = new NoArgsSuffix<object>(() => new object() );
     Assert.IsNotNull(suffix.Get());
 }
Пример #8
0
 public void CanCreate()
 {
     var suffix = new NoArgsSuffix<Encapsulation.Structure>(() => new MockStructure() );
     Assert.IsNotNull(suffix.Get());
 }