Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 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);
        }