Beispiel #1
0
        public void NullValueIsSerializedIntoEmptyString()
        {
            NullableEnumConverter <HttpStatusCode> converter = new NullableEnumConverter <HttpStatusCode>();
            HttpStatusCode?code          = null;
            StringBuilder  stringBuilder = new StringBuilder();

            converter.AppendToStringBuilder(stringBuilder, CultureInfo.InvariantCulture, code, null, ',');
            string serialized = stringBuilder.ToString();

            serialized.Should().Be("");
        }
Beispiel #2
0
        public void NullableEnumSerializerIsValid()
        {
            NullableEnumConverter <HttpStatusCode> converter = new NullableEnumConverter <HttpStatusCode>();
            HttpStatusCode?code          = HttpStatusCode.NotFound;
            StringBuilder  stringBuilder = new StringBuilder();

            converter.AppendToStringBuilder(stringBuilder, CultureInfo.InvariantCulture, code, null, ',');
            string serialized = stringBuilder.ToString();

            serialized.Should().Be("NotFound");
        }