示例#1
0
        public void Customized_SerializerSettings_WithoutConverter()
        {
            var sut = new SnapshotSerializer(new WithoutEnumConversion());

            var myState             = new { MyProp = MyEnum.FirstValue, OtherProp = MyEnum.LastValue, MyString = "String" };
            var snapEnumsAsIntegers = sut.SerializeObject(myState);

            snapEnumsAsIntegers.Should().Be("{\n  \"MyProp\": 1,\n  \"OtherProp\": 99,\n  \"MyString\": \"String\"\n}\n");
        }
示例#2
0
        public void Default_Serializer_EnumAsStrings()
        {
            var sut = new SnapshotSerializer(new DefaultSnapshotSerializerSettings());

            var myState            = new { MyProp = MyEnum.FirstValue, OtherProp = MyEnum.LastValue, MyString = "String" };
            var snapEnumsAsStrings = sut.SerializeObject(myState);

            snapEnumsAsStrings.Should().Be("{\n  \"MyProp\": \"FirstValue\",\n  \"OtherProp\": \"LastValue\",\n  \"MyString\": \"String\"\n}\n");
        }