Esempio n. 1
0
        public void OverlayingPluralizerAddsToOverlay()
        {
            var defaults = new DictionaryPluralizerCollection();
            var overlay  = new DictionaryPluralizerCollection();

            Pluralizer pluralizer;
            var        first  = new Mock <Pluralizer>().Object;
            var        second = new Mock <Pluralizer>().Object;

            Assert.True(defaults.TryAddPluralizer("first", first));
            var collection = new OverlayingPluralizerCollection(defaults, overlay);

            Assert.True(collection.TryAddPluralizer("second", second));
            Assert.True(overlay.TryGetPluralizer("second", out pluralizer));
            Assert.False(defaults.TryGetPluralizer("second", out pluralizer));
        }
Esempio n. 2
0
        public void OverlayingPluralizerWorks()
        {
            var defaults = new DictionaryPluralizerCollection();
            var overlay  = new DictionaryPluralizerCollection();

            Pluralizer pluralizer;
            var        first        = new Mock <Pluralizer>().Object;
            var        overlayFirst = new Mock <Pluralizer>().Object;
            var        third        = new Mock <Pluralizer>().Object;

            Assert.True(defaults.TryAddPluralizer("first", first));
            Assert.True(defaults.TryAddPluralizer("third", third));
            var collection = new OverlayingPluralizerCollection(defaults, overlay);

            Assert.True(collection.TryAddPluralizer("first", overlayFirst));

            Assert.True(collection.TryGetPluralizer("first", out pluralizer));
            Assert.Equal(pluralizer, overlayFirst);
            Assert.NotEqual(pluralizer, first);
            Assert.True(collection.TryGetPluralizer("third", out pluralizer));
            Assert.Equal(pluralizer, third);
        }