Example #1
0
        public void DynamicCreateLongTypedTuple()
        {
            object tup = Tupler.Create(1, "2", "3", 4,
                    5, 6, 7, "8", "9", 10, "11", 12);

            var tup2 = new Tuple<int, string, string, int, int, int, int, Tuple<string, string, int, string, int>>(
                1, "2", "3", 4,
                5, 6, 7, Tuple.Create("8", "9", 10, "11", 12)
                );

            Assert.That(tup, Is.TypeOf(tup2.GetType()));

            Assert.That(tup, Is.EqualTo(tup2));
        }
Example #2
0
        public static void Main(string[] args)
        {
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201408/20140809/linq-jvm
            // X:\jsc.svn\examples\java\Test\TestNewArrayGenericImport\TestNewArrayGenericImport\Class1.cs


            // X:\jsc.svn\examples\java\Test\TestLocalGenericArgumentReference\TestLocalGenericArgumentReference\Class1.cs

            System.Console.WriteLine(
   typeof(object).AssemblyQualifiedName
);


            var z = new Tuple<MemberInfo, int>[] {
                // Tuple.Create(item.m, index)
            };

            Console.WriteLine(z.GetType().FullName);

            CLRProgram.CLRMain();
        }
Example #3
0
 public void TupleCollection2()
 {
     var value = new Tuple<Int32,String,Boolean> (1, "jeb", false);
     var data = "0a01010a04036a65620a0100";
     var encodeResult = Encoder.Encode (value, value.GetType ());
     Assert.AreEqual (data, Hexlify (encodeResult));
     Tuple<Int32,String,Boolean> decodeResult = (Tuple<Int32,String,Boolean>)Encoder.Decode (Unhexlify (data), value.GetType (), null);
     Assert.AreEqual (value, decodeResult);
 }
Example #4
0
 public void TupleCollection1()
 {
     var value = new Tuple<Int32> (1);
     var data = "0a0101";
     var encodeResult = Encoder.Encode (value, value.GetType ());
     Assert.AreEqual (data, Hexlify (encodeResult));
     Tuple<Int32> decodeResult = (Tuple<Int32>)Encoder.Decode (Unhexlify (data), value.GetType (), null);
     Assert.AreEqual (value, decodeResult);
 }
Example #5
0
 public void TupleCollection2 ()
 {
     var value = new Tuple<int,string,bool> (1, "jeb", false);
     const string data = "0a01010a04036a65620a0100";
     var encodeResult = Encoder.Encode (value, value.GetType ());
     Assert.AreEqual (data, encodeResult.ToHexString ());
     var decodeResult = (Tuple<int,string,bool>)Encoder.Decode (data.ToByteString (), value.GetType (), null);
     Assert.AreEqual (value, decodeResult);
 }
Example #6
0
 public void TupleCollection1 ()
 {
     var value = new Tuple<int> (1);
     const string data = "0a0101";
     var encodeResult = Encoder.Encode (value, value.GetType ());
     Assert.AreEqual (data, encodeResult.ToHexString ());
     var decodeResult = (Tuple<int>)Encoder.Decode (data.ToByteString (), value.GetType (), null);
     Assert.AreEqual (value, decodeResult);
 }
 private static int MethodCallTestMethod(int arg)
 {
     var a = new Tuple<int, int>(arg, -arg);
     return a.GetType().GetHashCode();
 }
        public void TupleKeyInfoHelper_KeyMemberSelectorLarge2()
        {
            var tuple = 
                new Tuple<int, int, int, int, int, int, int, 
                    Tuple<int, int, int, int, int, int, int, 
                        Tuple<int, int>>>(
                1, 2, 3, 4, 5, 6, 7, 
                    new Tuple<int, int, int, int, int, int, int, Tuple<int, int>>(
                        8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16)));

            TupleKeyInfoHelper builder = new TupleKeyInfoHelper(tuple.GetType());

            Expression source = Expression.Constant(tuple);
            Expression selector = builder.CreateKeyMemberSelectorExpression(source, 15);

            int result = (int)Expression.Lambda(selector).Compile().DynamicInvoke();

            Assert.AreEqual(16, result);
        }