Example #1
0
        public void GivenThatIReadSettingsFromAnEmptyJsonFileVerifyEmptySettings()
        {
            var json = JsonUtility.Create(new Uri("http://tempuri.org/settings.json"), "Settings");

            var actual = FeedSettingsUtility.LoadSettings(FeedSettingsUtility.GetSettings(json));

            var expected = new FeedSettings();

            actual.ShouldBeEquivalentTo(expected);
        }
Example #2
0
        public void GivenThatICallLoadSettingsOnEmptySettingsVerifyDefaults()
        {
            var values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            var settings = FeedSettingsUtility.LoadSettings(values);

            // Defaults
            settings.CatalogEnabled.Should().BeFalse();
            settings.CatalogPageSize.Should().Be(1024);
            settings.SymbolsEnabled.Should().BeFalse();
        }
Example #3
0
        public void GivenThatICallLoadSettingsWithPageSizeOutRangeVerifyValues()
        {
            var values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "catalogpagesize", "0" },
                { "catalogenabled", "x" },
                { "symbolsfeedenabled", "asf" },
            };

            var settings = FeedSettingsUtility.LoadSettings(values);

            settings.CatalogPageSize.Should().Be(1);
            settings.CatalogEnabled.Should().BeFalse();
            settings.SymbolsEnabled.Should().BeFalse();
        }
Example #4
0
        public void GivenThatICallLoadSettingsWithUnknownSettingsVerifyValues()
        {
            var values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "a", "1" },
                { "b", "2" },
                { "c", "3" },
            };

            var settings = FeedSettingsUtility.LoadSettings(values);

            // Defaults
            settings.CatalogEnabled.Should().BeFalse();
            settings.CatalogPageSize.Should().Be(1024);
            settings.SymbolsEnabled.Should().BeFalse();
        }
Example #5
0
        public void GivenThatICallLoadFeedSettingsVerifyValues()
        {
            var settings = new FeedSettings()
            {
                CatalogEnabled  = false,
                CatalogPageSize = 5,
                SymbolsEnabled  = false
            };

            var values = FeedSettingsUtility.LoadSettings(settings);

            var expected = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "catalogenabled", "false" },
                { "symbolsfeedenabled", "false" },
                { "catalogpagesize", "5" },
            };

            values.ShouldBeEquivalentTo(expected);
        }