Пример #1
0
        public void AddGetRemoveTest()
        {
            var customOptions = new TypeConverterOptions
            {
                Format = "custom",
            };

            TypeConverterOptionsFactory.AddOptions <string>(customOptions);
            var options = TypeConverterOptionsFactory.GetOptions <string>();

            Assert.AreEqual(customOptions.Format, options.Format);

            TypeConverterOptionsFactory.RemoveOptions <string>();

            options = TypeConverterOptionsFactory.GetOptions <string>();

            Assert.AreNotEqual(customOptions.Format, options.Format);
        }
        public void AddGetRemoveTest()
        {
            var customOptions = new TypeConverterOptions
            {
                Formats = new string[] { "custom" },
            };
            var typeConverterOptionsFactory = new TypeConverterOptionsFactory();

            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);
        }