Exemple #1
0
        public void GetSettingsProviderShouldThrowIfSettingsNameIsNullOrEmpty()
        {
            var extensions           = this.GetMockExtensions("TestableSettings");
            var unfilteredExtensions = new List <LazyExtension <ISettingsProvider, Dictionary <string, object> > >
            {
                new LazyExtension <ISettingsProvider, Dictionary <string, object> >
                (
                    new Mock <ISettingsProvider>().Object,
                    new Dictionary <string, object>())
            };
            var spm = new TestableSettingsProviderManager(extensions, unfilteredExtensions, new Mock <IMessageLogger>().Object);

            Assert.ThrowsException <ArgumentException>(() => spm.GetSettingsProvider(null));
            Assert.ThrowsException <ArgumentException>(() => spm.GetSettingsProvider(string.Empty));
        }
Exemple #2
0
        public void GetSettingsProviderShouldReturnNullIfSettingsProviderWithSpecifiedNameIsNotFound()
        {
            var extensions           = this.GetMockExtensions("TestableSettings");
            var unfilteredExtensions = new List <LazyExtension <ISettingsProvider, Dictionary <string, object> > >
            {
                new LazyExtension <ISettingsProvider, Dictionary <string, object> >
                (
                    new Mock <ISettingsProvider>().Object,
                    new Dictionary <string, object>())
            };
            var spm = new TestableSettingsProviderManager(extensions, unfilteredExtensions, new Mock <IMessageLogger>().Object);

            var sp = spm.GetSettingsProvider("RandomSettingsWhichDoesNotExist");

            Assert.IsNull(sp);
        }
Exemple #3
0
        public void GetSettingsProviderShouldReturnSettingsProviderInstance()
        {
            var extensions           = this.GetMockExtensions("TestableSettings");
            var unfilteredExtensions = new List <LazyExtension <ISettingsProvider, Dictionary <string, object> > >
            {
                new LazyExtension <ISettingsProvider, Dictionary <string, object> >
                (
                    new Mock <ISettingsProvider>().Object,
                    new Dictionary <string, object>())
            };
            var spm = new TestableSettingsProviderManager(extensions, unfilteredExtensions, new Mock <IMessageLogger>().Object);

            var sp = spm.GetSettingsProvider("TestableSettings");

            Assert.IsNotNull(sp);
            Assert.IsNotNull(sp.Value);
        }