Ejemplo n.º 1
0
 public void CanGetDelegate()
 {
     var obj = new MockStructure();
     var suffix = new NoArgsSuffix<Encapsulation.Structure>(() => obj );
     var del = suffix.Get();
     Assert.IsNotNull(del);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
0
 public void CanCreate()
 {
     var suffix = new NoArgsSuffix<object>(() => new object() );
     Assert.IsNotNull(suffix.Get());
 }
Ejemplo n.º 8
0
 public void CanCreate()
 {
     var suffix = new NoArgsSuffix<Encapsulation.Structure>(() => new MockStructure() );
     Assert.IsNotNull(suffix.Get());
 }