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);
        }
        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);
        }
        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());
        }
        public void CanCreate()
        {
            var suffix = new NoArgsSuffix <Encapsulation.Structure>(() => new MockStructure());

            Assert.IsNotNull(suffix.Get());
        }