Exemplo n.º 1
0
 public void LengthOnFiveTuple()
 {
     const int expected = 5;
       var t = new Tuple<int, int, int, int, int>(-1, -2, -3, -4, -5);
       int actual = t.Length();
       Assert.AreEqual(expected, actual);
 }
Exemplo n.º 2
0
 public static IEnumerable AsEnumerable <T1, T2, T3, T4, T5, T6, T7>(this Tuple <T1, T2, T3, T4, T5, T6, T7> value)
 {
     for (int i = 0; i < value.Length(); i++)
     {
         yield return(value.Item(i));
     }
 }
Exemplo n.º 3
0
    //REMARK: AsEnumerable seems to be required for C# because C# demands instance an Instance Method for MoveNext and a Property for Current.
    //VB.NET allows the Use of an extension Method for MoveNext and and Extension Method for Current.
    //And since we implemented AsEnumerable with yield we loose the ability to for each over tuples in VB.NET withouth AsEnumerable too;(
    //TODO: decide whether to bring for each withouth AsEnumerable  back in VB.NET.

    public static IEnumerable AsEnumerable <T>(this Tuple <T> value)
    {
        for (int i = 0; i < value.Length(); i++)
        {
            yield return(value.Item(i));
        }
    }
Exemplo n.º 4
0
        public void LengthOnOneTuple()
        {
            const int expected = 1;
            var       t        = new Tuple <int>(-1);
            int       actual   = t.Length();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
        public void LengthOnSevenTuple()
        {
            const int expected = 7;
            var       t        = new Tuple <int, int, int, int, int, int, int>(-1, -2, -3, -4, -5, -6, -7);
            int       actual   = t.Length();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
        public void LengthOnFiveTuple()
        {
            const int expected = 5;
            var       t        = new Tuple <int, int, int, int, int>(-1, -2, -3, -4, -5);
            int       actual   = t.Length();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 7
0
        public void LengthOnThreeTuple()
        {
            const int expected = 3;
            var       t        = new Tuple <int, int, int>(-1, -2, -3);
            int       actual   = t.Length();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 8
0
    public static IEnumerable <TResult> Select <T, TResult>(this Tuple <T> value, Func <object, TResult> func)
    {
        int i = -1;

        while (++i < value.Length())
        {
            yield return(func(value.Item(i)));
        }
    }
Exemplo n.º 9
0
 public static IEnumerable <object> Where <T1, T2, T3, T4>(this Tuple <T1, T2, T3, T4> value, Func <object, bool> func)
 {
     for (int i = 0; i < value.Length(); i++)
     {
         if (func(value.Item(i)))
         {
             yield return(value.Item(i));
         }
     }
 }
Exemplo n.º 10
0
    public static IEnumerable <TResult> Select <T1, T2, T3, T4, T5, T6, T7, TResult>(this Tuple <T1, T2, T3, T4, T5, T6, T7> value,
                                                                                     Func <object, int, TResult> func)
    {
        int i = -1;

        while (++i < value.Length())
        {
            yield return(func(value.Item(i), i));
        }
    }
Exemplo n.º 11
0
 public void LengthOnOneTuple()
 {
     const int expected = 1;
       var t = new Tuple<int>(-1);
       int actual = t.Length();
       Assert.AreEqual(expected, actual);
 }
Exemplo n.º 12
0
 public void LengthOnTwoTuple()
 {
     const int expected = 2;
       var t = new Tuple<int, int>(-1, -2);
       int actual = t.Length();
       Assert.AreEqual(expected, actual);
 }
Exemplo n.º 13
0
 public void LengthOnSevenTuple()
 {
     const int expected = 7;
       var t = new Tuple<int, int, int, int, int, int, int>(-1, -2, -3, -4, -5, -6, -7);
       int actual = t.Length();
       Assert.AreEqual(expected, actual);
 }