Example #1
0
 public void ThreeValueMatchTwo()
 => Union
 .FromDefinition <ThreeDefinition>()
 .Create((sbyte)10)
 .Value()
 .Match(_ => false, _ => true, _ => false)
 .Should()
 .BeTrue();
Example #2
0
 public void FourValueMatchThree()
 => Union
 .FromDefinition <FourDefinition>()
 .Create((ushort)10)
 .Value()
 .Match(_ => false, _ => false, _ => true, _ => false)
 .Should()
 .BeTrue();
Example #3
0
 public void EightValueMatchFour()
 => Union
 .FromDefinition <EightDefinition>()
 .Create((short)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => true, _ => false, _ => false, _ => false, _ => false)
 .Should()
 .BeTrue();
Example #4
0
 public void EightValueMatchEight()
 => Union
 .FromDefinition <EightDefinition>()
 .Create((long)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => false, _ => false, _ => false, _ => false, _ => true)
 .Should()
 .BeTrue();
Example #5
0
 public void SevenValueMatchSeven()
 => Union
 .FromDefinition <SevenDefinition>()
 .Create((ulong)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => false, _ => false, _ => false, _ => true)
 .Should()
 .BeTrue();
Example #6
0
 public void TwoValueMatchOne()
 => Union
 .FromDefinition <TwoDefinition>()
 .Create((byte)10)
 .Value()
 .Match(_ => true, _ => false)
 .Should()
 .BeTrue();
Example #7
0
 public void SixValueMatchSix()
 => Union
 .FromDefinition <SixDefinition>()
 .Create((int)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => false, _ => false, _ => true)
 .Should()
 .BeTrue();
Example #8
0
 public void FiveValueMatchFive()
 => Union
 .FromDefinition <FiveDefinition>()
 .Create((uint)10)
 .Value()
 .Match(_ => false, _ => false, _ => false, _ => false, _ => true)
 .Should()
 .BeTrue();
Example #9
0
 public void OneValueMatchOne()
 => Union
 .FromDefinition <OneDefinition>()
 .Create((byte)10)
 .Value()
 .Match(_ => true)
 .Should()
 .BeTrue();
Example #10
0
        public void UnionDefinitionOneOfFourCanSerializeAndDeserialize()
        {
            var value = Union.FromDefinition <FourUnionDefinition>().Create((sbyte)64);

            SerializationUtility
            .CloneViaSerialization(value)
            .Value()
            .Do(_ => { }, _ => { }, _ => { }, _ => { })
            .Should()
            .BeEquivalentTo(value);
        }
Example #11
0
        public void UnionDefinitionThreeOfThreeCanSerializeAndDeserialize()
        {
            var value = Union.FromDefinition <ThreeUnionDefinition>().Create((short)64);

            SerializationUtility
            .CloneViaSerialization(value)
            .Value()
            .Do(_ => { }, _ => { }, _ => { })
            .Should()
            .BeEquivalentTo(value);
        }
Example #12
0
        public void UnionDefinitionEightOfEightCanSerializeAndDeserialize()
        {
            var value = Union.FromDefinition <EightUnionDefinition>().Create((ulong)64);

            SerializationUtility
            .CloneViaSerialization(value)
            .Value()
            .Do(_ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { })
            .Should()
            .BeEquivalentTo(value);
        }
Example #13
0
        public void UnionDefinitionSixOfSevenCanSerializeAndDeserialize()
        {
            var value = Union.FromDefinition <SevenUnionDefinition>().Create((uint)64);

            SerializationUtility
            .CloneViaSerialization(value)
            .Value()
            .Do(_ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { })
            .Should()
            .BeEquivalentTo(value);
        }
Example #14
0
 private IEnumerable <Union <OneDefinition> > CreateDefinitionArray()
 => new[]
 {
     Union.FromDefinition <OneDefinition>().Create((sbyte)1),
     Union.FromDefinition <OneDefinition>().Create((byte)1),
 };