Exemple #1
0
        public void CanConvertShouldReturnTrue(Type objectType)
        {
            // the converter is intended for Guids and nothing else
            // NOTE! CanConvert method is not called ny json.net if using with the JsonConverterAttribute
            // like this: [JsonConverter(typeof(StringGuidConverter))]

            StringGuidConverter converter = new StringGuidConverter();

            converter.CanConvert(objectType).Should().BeTrue();
        }
Exemple #2
0
        public void CanConvertShouldReturnFalse(Type objectType)
        {
            // the converter is intended for Guids and nothing else
            // NOTE! CanConvert method is not called by json.net if using with the JsonConverterAttribute
            // like this: [JsonConverter(typeof(StringGuidConverter))]

            StringGuidConverter converter = new StringGuidConverter();

            converter.CanConvert(objectType).Should().BeFalse("Because the converter can only support Guid to string and back to Guid conversions.");
        }
Exemple #3
0
        public void CanConvertGuid()
        {
            StringGuidConverter converter = new StringGuidConverter();

            converter.CanConvert(typeof(Guid)).Should().BeTrue();
        }