コード例 #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),
 };
コード例 #2
0
 public void FourValueMatchFour()
 => Union
 .FromTypes <byte, sbyte, ushort, short>()
 .Create((short)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => true)
 .Should()
 .BeTrue();
コード例 #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();
コード例 #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();
コード例 #5
0
 public void TwoValueMatchTwo()
 => Union
 .FromTypes <byte, sbyte>()
 .Create((sbyte)10)
 .Value()
 .Match(_ => false, _ => true)
 .Should()
 .BeTrue();
コード例 #6
0
 public void ThreeValueMatchThree()
 => Union
 .FromTypes <byte, sbyte, ushort>()
 .Create((ushort)10)
 .Value()
 .Match(_ => false, _ => false, _ => true)
 .Should()
 .BeTrue();
コード例 #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();
コード例 #8
0
 public void FiveValueMatchTwo()
 => Union
 .FromTypes <byte, sbyte, ushort, short, uint>()
 .Create((sbyte)10)
 .Value()
 .Match(_ => false, _ => true, _ => false, _ => false, _ => false)
 .Should()
 .BeTrue();
コード例 #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),
 };
コード例 #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),
 };
コード例 #11
0
		public void AdhocUnionTwoOfFourCanSerializeAndDeserialize()
		{
			var value = Union.FromTypes<sbyte, byte, short, ushort>().Create((byte)64);

			SerializationUtility
				.CloneViaSerialization(value)
				.Value()
				.Do(_ => { }, _ => { }, _ => { }, _ => { })
				.Should()
				.BeEquivalentTo(value);
		}
コード例 #12
0
		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);
		}
コード例 #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();
            }
コード例 #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();
            }
コード例 #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();
            }
コード例 #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();
            }
コード例 #17
0
            public void FourValueDoThree()
            {
                bool result = false;

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

                result.Should().BeTrue();
            }
コード例 #18
0
            public void TwoValueDoTwo()
            {
                bool result = false;

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

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