Exemple #1
0
        public void AddProviders_GivenDuplicate_ThenThrows()
        {
            var mockProviders = new []
            {
                new CustomDiacriticProvider(new Dictionary <char, string>()),
                new CustomDiacriticProvider(new Dictionary <char, string>())
            };

            DiacriticMap.AddProviders(mockProviders);

            Assert.Throws <Exception>(() =>
                                      DiacriticMap.AddProviders(mockProviders));
        }
Exemple #2
0
        public void AddProviders_GivenDuplicateMappings_ThenTakeLast()
        {
            var mockProviders = new[]
            {
                new CustomDiacriticProvider(new Dictionary <char, string> {
                    { '~', "1" }
                }),
                new CustomDiacriticProvider(new Dictionary <char, string> {
                    { '~', "2" }
                })
            };

            DiacriticMap.AddProviders(mockProviders);

            var result = "~".RemoveDiacritics();

            Assert.AreEqual("2", result);
        }