示例#1
0
 public void DeepCopyTests_FSharp_Types()
 {
     // discriminated union case with an array field
     {
         var original = DiscriminatedUnion.nonEmptyArray();
         var copy     = (DiscriminatedUnion)this.fixture.SerializationManager.DeepCopy(original);
         Assert.Equal(original, copy);
     }
     {
         var original = DiscriminatedUnion.emptyArray();
         var copy     = (DiscriminatedUnion)this.fixture.SerializationManager.DeepCopy(original);
         Assert.Equal(original, copy);
     }
     // discriminated union case with an F# list field
     {
         var original = DiscriminatedUnion.emptyList();
         var copy     = (DiscriminatedUnion)this.fixture.SerializationManager.DeepCopy(original);
         Assert.Equal(original, copy);
     }
     {
         var original = DiscriminatedUnion.nonEmptyList();
         var copy     = (DiscriminatedUnion)this.fixture.SerializationManager.DeepCopy(original);
         Assert.Equal(original, copy);
     }
     // discriminated union case with an F# set field
     {
         var original = DiscriminatedUnion.emptySet();
         var copy     = (DiscriminatedUnion)this.fixture.SerializationManager.DeepCopy(original);
         Assert.Equal(original, copy);
     }
     {
         var original = DiscriminatedUnion.nonEmptySet();
         var copy     = (DiscriminatedUnion)this.fixture.SerializationManager.DeepCopy(original);
         Assert.Equal(original, copy);
     }
     // discriminated union case with an F# map field
     {
         var original = DiscriminatedUnion.emptyMap();
         var copy     = (DiscriminatedUnion)this.fixture.SerializationManager.DeepCopy(original);
         Assert.Equal(original, copy);
     }
     {
         var original = DiscriminatedUnion.nonEmptyMap();
         var copy     = (DiscriminatedUnion)this.fixture.SerializationManager.DeepCopy(original);
         Assert.Equal(original, copy);
     }
 }
示例#2
0
        public void SerializationTests_FSharp_Discriminated_Union()
        {
            // discriminated union case with an array field
            RoundtripSerializationTest(DiscriminatedUnion.emptyArray());
            RoundtripSerializationTest(DiscriminatedUnion.nonEmptyArray());

            // discriminated union case with an F# list field
            RoundtripSerializationTest(DiscriminatedUnion.emptyList());
            RoundtripSerializationTest(DiscriminatedUnion.nonEmptyList());

            // discriminated union case with an F# set field
            RoundtripSerializationTest(DiscriminatedUnion.emptySet());
            RoundtripSerializationTest(DiscriminatedUnion.nonEmptySet());

            // discriminated union case with an F# map  field
            RoundtripSerializationTest(DiscriminatedUnion.emptyMap());
            RoundtripSerializationTest(DiscriminatedUnion.nonEmptyMap());
        }