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

            var values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "a", "1" },
                { "b", "2" },
                { "c", "3" },
            };

            var values2 = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "a", "1" },
                { "c", "3" },
            };

            FeedSettingsUtility.Set(json, values);

            FeedSettingsUtility.Set(json, values2);

            var actual = FeedSettingsUtility.GetSettings(json);

            actual.ShouldBeEquivalentTo(values2);
        }
Beispiel #2
0
        public void GivenThatIWriteSettingsVerifyTheyPersistForUnknownValues()
        {
            var json = JsonUtility.Create(new Uri("http://tempuri.org/settings.json"), "Settings");

            var values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "a", "1" },
                { "b", "2" },
                { "c", "3" },
            };

            FeedSettingsUtility.Set(json, values);

            var actual = FeedSettingsUtility.GetSettings(json);

            actual.ShouldBeEquivalentTo(values);
        }
Beispiel #3
0
        public void GivenThatIWriteSettingsVerifyTheyPersist()
        {
            var json = JsonUtility.Create(new Uri("http://tempuri.org/settings.json"), "Settings");

            var values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "catalogenabled", "true" },
                { "symbolsfeedenabled", "true" },
                { "catalogpagesize", "10" },
            };

            FeedSettingsUtility.Set(json, values);

            var actual = FeedSettingsUtility.GetSettings(json);

            actual.ShouldBeEquivalentTo(values);
        }
Beispiel #4
0
        public void GivenThatIUnsetAllVerifyNoSettings()
        {
            var json = JsonUtility.Create(new Uri("http://tempuri.org/settings.json"), "Settings");

            var values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "a", "1" },
                { "b", "2" },
                { "c", "3" },
            };

            FeedSettingsUtility.Set(json, values);

            FeedSettingsUtility.UnsetAll(json);

            var actual = FeedSettingsUtility.GetSettings(json);

            actual.Should().BeEmpty();
        }