Exemple #1
0
 private IEnumerable <Union <sbyte, byte, short> > CreateTypesThreeArray()
 => new[]
 {
     Union.FromTypes <sbyte, byte, short>().Create((sbyte)1),
     Union.FromTypes <sbyte, byte, short>().Create((byte)1),
     Union.FromTypes <sbyte, byte, short>().Create((short)1),
 };
Exemple #2
0
 public void FourValueMatchFour()
 => Union
 .FromTypes <byte, sbyte, ushort, short>()
 .Create((short)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => true)
 .Should()
 .BeTrue();
Exemple #3
0
 public void EightValueMatchEight()
 => Union
 .FromTypes <byte, sbyte, ushort, short, uint, int, ulong, long>()
 .Create((long)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => false, _ => false, _ => false, _ => false, _ => true)
 .Should()
 .BeTrue();
Exemple #4
0
 public void SevenValueMatchSix()
 => Union
 .FromTypes <byte, sbyte, ushort, short, uint, int, ulong>()
 .Create((int)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => false, _ => false, _ => true, _ => false)
 .Should()
 .BeTrue();
Exemple #5
0
 public void TwoValueMatchTwo()
 => Union
 .FromTypes <byte, sbyte>()
 .Create((sbyte)10)
 .Value()
 .Match(_ => false, _ => true)
 .Should()
 .BeTrue();
Exemple #6
0
 public void ThreeValueMatchThree()
 => Union
 .FromTypes <byte, sbyte, ushort>()
 .Create((ushort)10)
 .Value()
 .Match(_ => false, _ => false, _ => true)
 .Should()
 .BeTrue();
Exemple #7
0
 public void SixValueMatchFive()
 => Union
 .FromTypes <byte, sbyte, ushort, short, uint, int>()
 .Create((uint)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => false, _ => true, _ => false)
 .Should()
 .BeTrue();
Exemple #8
0
 public void FiveValueMatchTwo()
 => Union
 .FromTypes <byte, sbyte, ushort, short, uint>()
 .Create((sbyte)10)
 .Value()
 .Match(_ => false, _ => true, _ => false, _ => false, _ => false)
 .Should()
 .BeTrue();
Exemple #9
0
 private IEnumerable <Union <sbyte, byte, short, ushort, int> > CreateTypesFiveArray()
 => new[]
 {
     Union.FromTypes <sbyte, byte, short, ushort, int>().Create((sbyte)1),
     Union.FromTypes <sbyte, byte, short, ushort, int>().Create((byte)1),
     Union.FromTypes <sbyte, byte, short, ushort, int>().Create((short)1),
     Union.FromTypes <sbyte, byte, short, ushort, int>().Create((ushort)1),
     Union.FromTypes <sbyte, byte, short, ushort, int>().Create(1),
 };
Exemple #10
0
 private IEnumerable <Union <sbyte, byte, short, ushort, int, uint, long> > CreateTypesSevenArray()
 => new[]
 {
     Union.FromTypes <sbyte, byte, short, ushort, int, uint, long>().Create((sbyte)1),
     Union.FromTypes <sbyte, byte, short, ushort, int, uint, long>().Create((byte)1),
     Union.FromTypes <sbyte, byte, short, ushort, int, uint, long>().Create((short)1),
     Union.FromTypes <sbyte, byte, short, ushort, int, uint, long>().Create((ushort)1),
     Union.FromTypes <sbyte, byte, short, ushort, int, uint, long>().Create(1),
     Union.FromTypes <sbyte, byte, short, ushort, int, uint, long>().Create((uint)1),
     Union.FromTypes <sbyte, byte, short, ushort, int, uint, long>().Create((long)1),
 };
		public void AdhocUnionTwoOfFourCanSerializeAndDeserialize()
		{
			var value = Union.FromTypes<sbyte, byte, short, ushort>().Create((byte)64);

			SerializationUtility
				.CloneViaSerialization(value)
				.Value()
				.Do(_ => { }, _ => { }, _ => { }, _ => { })
				.Should()
				.BeEquivalentTo(value);
		}
		public void AdhocUnionEightOfEightCanSerializeAndDeserialize()
		{
			var value = Union.FromTypes<sbyte, byte, short, ushort, int, uint, long, ulong>().Create((ulong)64);

			SerializationUtility
				.CloneViaSerialization(value)
				.Value()
				.Do(_ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { })
				.Should()
				.BeEquivalentTo(value);
		}
Exemple #13
0
            public void EightValueDoEight()
            {
                bool result = false;

                Union
                .FromTypes <byte, sbyte, ushort, short, uint, int, ulong, long>()
                .Create((long)10)
                .Value()
                .Do(_ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => result = true);

                result.Should().BeTrue();
            }
Exemple #14
0
            public void SevenValueDoSix()
            {
                bool result = false;

                Union
                .FromTypes <byte, sbyte, ushort, short, uint, int, ulong>()
                .Create((int)10)
                .Value()
                .Do(_ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => result = true, _ => { });

                result.Should().BeTrue();
            }
Exemple #15
0
            public void SixValueDoFour()
            {
                bool result = false;

                Union
                .FromTypes <byte, sbyte, ushort, short, uint, int>()
                .Create((short)10)
                .Value()
                .Do(_ => { }, _ => { }, _ => { }, _ => result = true, _ => { }, _ => { });

                result.Should().BeTrue();
            }
Exemple #16
0
            public void FiveValueDoFive()
            {
                bool result = false;

                Union
                .FromTypes <byte, sbyte, ushort, short, uint>()
                .Create((uint)10)
                .Value()
                .Do(_ => { }, _ => { }, _ => { }, _ => { }, _ => result = true);

                result.Should().BeTrue();
            }
Exemple #17
0
            public void FourValueDoThree()
            {
                bool result = false;

                Union
                .FromTypes <byte, sbyte, ushort, short>()
                .Create((ushort)10)
                .Value()
                .Do(_ => { }, _ => { }, _ => result = true, _ => { });

                result.Should().BeTrue();
            }
Exemple #18
0
            public void TwoValueDoTwo()
            {
                bool result = false;

                Union
                .FromTypes <byte, sbyte>()
                .Create((sbyte)10)
                .Value()
                .Do(_ => { }, _ => result = true);

                result.Should().BeTrue();
            }
Exemple #19
0
 private IEnumerable <Union <sbyte, byte> > CreateTypesTwoArray()
 => new[]
 {
     Union.FromTypes <sbyte, byte>().Create((sbyte)1),
     Union.FromTypes <sbyte, byte>().Create((byte)1),
 };
 public static ParsedMethodBody Create(MethodInfo method, Instruction[] instructions)
 => new ParsedMethodBody(Union.FromTypes <ConstructorInfo, MethodInfo>().Create(method), instructions);