public static void SetDefaultConfiguration(this TypeConverterOptionsCache cache) { var options = new TypeConverterOptions { Formats = new[] { "O" } }; cache.AddOptions <DateTimeOffset>(options); }
public void AddGetRemoveTest() { var customOptions = new TypeConverterOptions { Formats = new string[] { "custom" }, }; var typeConverterOptionsFactory = new TypeConverterOptionsCache(); typeConverterOptionsFactory.AddOptions <string>(customOptions); var options = typeConverterOptionsFactory.GetOptions <string>(); Assert.AreEqual(customOptions.Formats, options.Formats); typeConverterOptionsFactory.RemoveOptions <string>(); options = typeConverterOptionsFactory.GetOptions <string>(); Assert.AreNotEqual(customOptions.Formats, options.Formats); }