public void ConstructorByDelegateWithType_NoParams()
        {
            var c = DelegateFactory.Contructor <Func <TestClass> >();

            Assert.IsNotNull(c);
            Assert.IsNotNull(c());
            Assert.IsInstanceOfType(c(), TestClassType);
        }
        public void IndexerSet_ByTypes_Protected()
        {
            var @is = DelegateFactory.IndexerSet <TestClass, byte, byte>();

            Assert.IsNotNull(@is);
            @is(_testClassInstance, FirstByteIndex, NewByteValue);
            Assert.AreEqual(NewByteValue, _testClassInstance.ProtectedIndexer);
        }
        public void IndexerSet_ByTypes_1Index_FromStruct()
        {
            var @is = DelegateFactory.IndexerSetStruct <TestStruct, int, int>();

            Assert.IsNotNull(@is);
            @is(ref _testStructInstance, FirstIntIndex, NewIntValue);
            Assert.AreEqual(NewIntValue, _testStructInstance.IndexerBackend[FirstIntIndex]);
        }
        public void IndexerSet_ByObjects_Public()
        {
            var @is = _testClassType.IndexerSet(typeof(int), typeof(int));

            Assert.IsNotNull(@is);
            @is(_testClassInstance, new object[] { FirstIntIndex }, NewIntValue);
            Assert.AreEqual(NewIntValue, _testClassInstance.IndexerBackend[FirstIntIndex]);
        }
        public void IndexerSet_ByTypes_Internal_FromStruct()
        {
            var @is = DelegateFactory.IndexerSetStruct <TestStruct, double, double>();

            Assert.IsNotNull(@is);
            @is(ref _testStructInstance, FirstDoubleIndex, NewDoubleValue);
            Assert.AreEqual(NewDoubleValue, _testStructInstance.InternalIndexer);
        }
        public void IndexerSet_ByExtensionAndReturnType_Public()
        {
            var @is = _testClassType.IndexerSet <int, int>();

            Assert.IsNotNull(@is);
            @is(_testClassInstance, FirstIntIndex, NewIntValue);
            Assert.AreEqual(NewIntValue, _testClassInstance.IndexerBackend[FirstIntIndex]);
        }
        public void IndexerSet_ByObjects_Private()
        {
            var @is = _testClassType.IndexerSet(typeof(int), typeof(int), typeof(int));

            Assert.IsNotNull(@is);
            @is(_testClassInstance, new object[] { FirstIntIndex, SecondIntIndex }, NewIntValue);
            Assert.AreEqual(NewIntValue, _testClassInstance.PrivateIndexer);
        }
Exemplo n.º 8
0
        public void PropertySet_ByObjects_Internal()
        {
            var sps = TestClassType.StaticPropertySet("StaticInternalProperty");

            Assert.IsNotNull(sps);
            sps(NewStringValue);
            Assert.AreEqual(NewStringValue, TestClass.StaticInternalProperty);
        }
Exemplo n.º 9
0
        public void PropertySet_ByObjects_Protected()
        {
            var sps = TestClassType.StaticPropertySet("StaticProtectedProperty");

            Assert.IsNotNull(sps);
            sps(NewStringValue);
            Assert.AreEqual(NewStringValue, TestClass.GetStaticProtectedProperty());
        }
        public void DefaultConstructor_WithType()
        {
            var cd = DelegateFactory.DefaultContructor <TestClass>();

            Assert.IsNotNull(cd);
            Assert.IsNotNull(cd());
            Assert.IsInstanceOfType(cd(), TestClassType);
        }
Exemplo n.º 11
0
        public void PropertySet_ByExtensionAndReturnType_Public_Struct_FromStruct()
        {
            var sps = TestStructType.StaticPropertySet <int>("StaticPublicPropertyValue");

            Assert.IsNotNull(sps);
            sps(NewIntValue);
            Assert.AreEqual(NewIntValue, TestStruct.StaticPublicPropertyValue);
        }
        public void DefaultConstructor_WithoutType()
        {
            var cd = TestClassType.DefaultContructor();

            Assert.IsNotNull(cd);
            Assert.IsNotNull(cd());
            Assert.IsInstanceOfType(cd(), TestClassType);
        }
        public void DefaultConstructor_ByDelegate_WithType_ByDelegate()
        {
            var cd = TestClassType.Contructor <Func <TestClass> >();

            Assert.IsNotNull(cd);
            Assert.IsNotNull(cd());
            Assert.IsInstanceOfType(cd(), TestClassType);
        }
        public void ConstructorByDelegateWithType_WithCustomDelegate_NoParams()
        {
            var cd = DelegateFactory.Contructor <CustomCtr>();

            Assert.IsNotNull(cd);
            Assert.IsNotNull(cd());
            Assert.IsInstanceOfType(cd(), TestClassType);
        }
Exemplo n.º 15
0
        public void PropertySet_ByExtensionAndReturnType_Public()
        {
            var sps = TestClassType.StaticPropertySet <string>("StaticPublicProperty");

            Assert.IsNotNull(sps);
            sps(NewStringValue);
            Assert.AreEqual(NewStringValue, TestClass.StaticPublicProperty);
        }
Exemplo n.º 16
0
        public void PropertySet_ByObjects_Public_FromStruct()
        {
            var sps = TestStructType.StaticPropertySet("StaticPublicProperty");

            Assert.IsNotNull(sps);
            sps(NewStringValue);
            Assert.AreEqual(NewStringValue, TestStruct.StaticPublicProperty);
        }
        public void IndexerSet_ByExtensionAndReturnType_Protected()
        {
            var @is = _testClassType.IndexerSet <byte, byte>();

            Assert.IsNotNull(@is);
            @is(_testClassInstance, FirstByteIndex, NewByteValue);
            Assert.AreEqual(NewByteValue, _testClassInstance.ProtectedIndexer);
        }
Exemplo n.º 18
0
        public void PropertySet_ByObjects_Public_Struct()
        {
            var sps = TestClassType.StaticPropertySet("StaticPublicPropertyValue");

            Assert.IsNotNull(sps);
            sps(NewIntValue);
            Assert.AreEqual(NewIntValue, TestClass.StaticPublicPropertyValue);
        }
        public void IndexerSet_ByObjects_Internal()
        {
            var @is = _testClassType.IndexerSet(typeof(double), typeof(double));

            Assert.IsNotNull(@is);
            @is(_testClassInstance, new object[] { FirstDoubleIndex }, NewDoubleValue);
            Assert.AreEqual(NewDoubleValue, _testClassInstance.InternalIndexer);
        }
Exemplo n.º 20
0
        public void PropertySet_ByTypes_Internal()
        {
            var sps = DelegateFactory.StaticPropertySet <TestClass, string>("StaticInternalProperty");

            Assert.IsNotNull(sps);
            sps(NewStringValue);
            Assert.AreEqual(NewStringValue, TestClass.StaticInternalProperty);
        }
        public void IndexerSet_ByObjects_Protected()
        {
            var @is = _testClassType.IndexerSet(typeof(byte), typeof(byte));

            Assert.IsNotNull(@is);
            @is(_testClassInstance, new object[] { FirstByteIndex }, NewByteValue);
            Assert.AreEqual(NewByteValue, _testClassInstance.ProtectedIndexer);
        }
Exemplo n.º 22
0
        public void PropertySet_ByTypes_Protected()
        {
            var sps = DelegateFactory.StaticPropertySet <TestClass, string>("StaticProtectedProperty");

            Assert.IsNotNull(sps);
            sps(NewStringValue);
            Assert.AreEqual(NewStringValue, TestClass.GetStaticProtectedProperty());
        }
        public void IndexerSet_ByTypes_Internal()
        {
            var @is = DelegateFactory.IndexerSet <TestClass, double, double>();

            Assert.IsNotNull(@is);
            @is(_testClassInstance, FirstDoubleIndex, NewDoubleValue);
            Assert.AreEqual(NewDoubleValue, _testClassInstance.InternalIndexer);
        }
Exemplo n.º 24
0
        public void PropertySet_ByTypes_Public_FromStruct()
        {
            var sps = DelegateFactory.StaticPropertySet <TestStruct, string>("StaticPublicProperty");

            Assert.IsNotNull(sps);
            sps(NewStringValue);
            Assert.AreEqual(NewStringValue, TestStruct.StaticPublicProperty);
        }
        public void IndexerSet_ByTypes_Private_FromStruct()
        {
            var @is = DelegateFactory.IndexerSetStruct <TestStruct, int, int, int>();

            Assert.IsNotNull(@is);
            @is(ref _testStructInstance, FirstIntIndex, SecondIntIndex, NewIntValue);
            Assert.AreEqual(NewIntValue, _testStructInstance.PrivateIndexer);
        }
Exemplo n.º 26
0
        public void PropertySet_ByTypes_Public_StructFromStruct()
        {
            var sps = DelegateFactory.StaticPropertySet <TestStruct, int>("StaticPublicPropertyValue");

            Assert.IsNotNull(sps);
            sps(NewIntValue);
            Assert.AreEqual(NewIntValue, TestStruct.StaticPublicPropertyValue);
        }
        public void IndexerSet_ByTypes_Public()
        {
            var @is = DelegateFactory.IndexerSet <TestClass, int, int>();

            Assert.IsNotNull(@is);
            @is(_testClassInstance, FirstIntIndex, NewIntValue);
            Assert.AreEqual(NewIntValue, _testClassInstance.IndexerBackend[FirstIntIndex]);
        }
Exemplo n.º 28
0
        public void PropertySet_ByExtensionAndReturnType_Private_FromStruct()
        {
            var sps = TestStructType.StaticPropertySet <string>("StaticPrivateProperty");

            Assert.IsNotNull(sps);
            sps(NewStringValue);
            Assert.AreEqual(NewStringValue, TestStruct.GetStaticPrivateProperty());
        }
        public void IndexerSet_ByTypes_2Index()
        {
            var @is = DelegateFactory.IndexerSet <TestClass, int, int, int>();

            Assert.IsNotNull(@is);
            @is(_testClassInstance, FirstIntIndex, SecondIntIndex, NewIntValue);
            Assert.AreEqual(NewIntValue, _testClassInstance.PrivateIndexer);
        }
        public void GenericMethod_SingleTypeParameter_FromStruct()
        {
            var m = DelegateFactory.InstanceMethod <Action <TestClass, TestClass>, TestClass>("InstanceGenericMethodVoid");

            Assert.IsNotNull(m);
            m(_testClassInstance, _testClassInstance);
            Assert.AreEqual(_testClassInstance, _testClassInstance.InstanceGenericMethodVoidParameter);
        }