Пример #1
0
        public void ZeroValueTupleTests()
        {
            var info = TupleInfo.GetInfo <ValueTuple>();

            info.TupleType.Should().Be(typeof(ValueTuple));
            info.ItemTypes.Should().BeEmpty();
            info.CreateNew(new object[0]).Should().Be(ValueTuple.Create());
        }
Пример #2
0
        public void EightTupleTests()
        {
            var info = TupleInfo.GetInfo <Tuple <int, int, int, int, int, int, int, Tuple <int> > >();

            info.TupleType.Should().Be(typeof(Tuple <int, int, int, int, int, int, int, Tuple <int> >));
            info.ItemTypes.Should().Equal(Enumerable.Repeat(typeof(int), 8));
            info.CreateNew(new object[] { 1, 2, 3, 4, 5, 6, 7, 8 }).Should().Be(Tuple.Create(1, 2, 3, 4, 5, 6, 7, 8));
        }
Пример #3
0
        public void OneTupleTests()
        {
            var info = TupleInfo.GetInfo <Tuple <int> >();

            info.TupleType.Should().Be(typeof(Tuple <int>));
            info.ItemTypes.Should().Equal(typeof(int));
            info.CreateNew(new object[] { 1 }).Should().Be(new Tuple <int>(1));
        }
Пример #4
0
 public void WeakNonTupleType()
 {
     Invoking(() => TupleInfo.GetInfo(typeof(int)))
     .Should().Throw <InvalidOperationException>();
 }
Пример #5
0
 public void StrongNonTupleType()
 {
     Invoking(() => TupleInfo.GetInfo <int>())
     .Should().Throw <InvalidOperationException>();
 }