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()); }
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)); }
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)); }
public void WeakNonTupleType() { Invoking(() => TupleInfo.GetInfo(typeof(int))) .Should().Throw <InvalidOperationException>(); }
public void StrongNonTupleType() { Invoking(() => TupleInfo.GetInfo <int>()) .Should().Throw <InvalidOperationException>(); }