public AquaContractResolver(IContractResolver?decorated = null) { if (decorated is AquaContractResolver self) { decorated = self._decorated; } _decorated = decorated?.GetType() == typeof(DefaultContractResolver) ? null : decorated; }
public AquaContractResolver(KnownTypesRegistry knownTypes, IContractResolver?decorated = null) { if (decorated is AquaContractResolver self) { decorated = self._decorated; } _knownTypes = knownTypes.CheckNotNull(nameof(knownTypes)); _decorated = decorated?.GetType() == typeof(DefaultContractResolver) ? null : decorated; }
private static string ToCamelCaseIfNeeded(string input, IContractResolver resolver) { if (resolver == null) { return(input); } if (resolver.GetType().IsAssignableFrom(typeof(CamelCasePropertyNamesContractResolver))) { return(ToCamelCase(input)); } else { return(input); } }
public void Initialize_CamelCaseFormatterIsSet() { IContractResolver contractResolver = controller.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver; Assert.AreEqual(contractResolver.GetType(), typeof(CamelCasePropertyNamesContractResolver)); }