Пример #1
0
        public void RemoveTheme_Reordered()
        {
            var palette = new ColorPalette();
            var theme1  = palette.Themes.First().Value;
            var theme2  = palette.AddTheme();
            var theme3  = palette.AddTheme();

            Assert.That(palette.GetThemeOrder(theme1.Id), Is.EqualTo(0));
            Assert.That(palette.GetThemeOrder(theme2.Id), Is.EqualTo(1));
            Assert.That(palette.GetThemeOrder(theme3.Id), Is.EqualTo(2));

            palette.RemoveTheme(theme2.Id);

            Assert.That(palette.GetThemeOrder(theme1.Id), Is.EqualTo(0));
            Assert.That(palette.GetThemeOrder(theme3.Id), Is.EqualTo(1));
        }
Пример #2
0
        public void AddTheme_ThemeIsAdded()
        {
            var palette = new ColorPalette();

            Assert.That(palette.Themes.Count, Is.EqualTo(1));
            palette.AddTheme();
            Assert.That(palette.Themes.Count, Is.EqualTo(2));
        }
Пример #3
0
        public void SetThemeOrder_OrderIsSetProperly()
        {
            var palette = new ColorPalette();
            var theme1  = palette.Themes.First().Value;
            var theme2  = palette.AddTheme();
            var theme3  = palette.AddTheme();

            Assert.That(palette.GetThemeOrder(theme1.Id), Is.EqualTo(0));
            Assert.That(palette.GetThemeOrder(theme2.Id), Is.EqualTo(1));
            Assert.That(palette.GetThemeOrder(theme3.Id), Is.EqualTo(2));

            palette.SetThemeOrder(theme3.Id, 1);

            Assert.That(palette.GetThemeOrder(theme1.Id), Is.EqualTo(0));
            Assert.That(palette.GetThemeOrder(theme2.Id), Is.EqualTo(2));
            Assert.That(palette.GetThemeOrder(theme3.Id), Is.EqualTo(1));
        }
Пример #4
0
        public void AddTheme_OrderIsSet()
        {
            var palette = new ColorPalette();
            var theme1  = palette.Themes.First().Value;
            var theme2  = palette.AddTheme();

            Assert.That(palette.GetThemeOrder(theme1.Id), Is.EqualTo(0));
            Assert.That(palette.GetThemeOrder(theme2.Id), Is.EqualTo(1));
        }
Пример #5
0
        public void AddTheme_EntryValueIsAdded()
        {
            var palette = new ColorPalette();
            var entry   = palette.AddEntry();
            var theme   = palette.AddTheme();

            Assert.That(entry.Values.Count, Is.EqualTo(2));
            Assert.That(entry.Values.ContainsKey(theme.Id), Is.True);
        }
Пример #6
0
        public void RemoveTheme_ThemeRemoved()
        {
            var palette = new ColorPalette();
            var theme   = palette.AddTheme();

            Assert.That(palette.Themes.Count, Is.EqualTo(2));
            palette.RemoveTheme(theme.Id);

            Assert.That(palette.Themes.Count, Is.EqualTo(1));
        }
Пример #7
0
        public void RemoveTheme_RemoveEntryValues()
        {
            var palette = new ColorPalette();
            var entry   = palette.AddEntry();
            var theme   = palette.AddTheme();

            Assert.That(entry.TryGetValue(theme.Id, out _), Is.True);

            palette.RemoveTheme(theme.Id);

            Assert.That(entry.TryGetValue(theme.Id, out _), Is.False);
        }
Пример #8
0
        public void RestoreTheme_AddEntryAfterRemove_NewEntryHasValueForRestoredTheme()
        {
            var palette = new ColorPalette();
            var theme   = palette.AddTheme();

            palette.RemoveTheme(theme.Id);
            var entry = palette.AddEntry();

            Assert.That(entry.Values.ContainsKey(theme.Id), Is.False);

            palette.RestoreTheme(theme.Id);

            Assert.That(entry.Values.ContainsKey(theme.Id), Is.True);
        }
Пример #9
0
        public void RemoveTheme_RemoveActiveTheme_ChangeToDefaultTheme()
        {
            var palette      = new ColorPalette();
            var defaultTheme = palette.Themes.First().Value;
            var theme        = palette.AddTheme();

            palette.SetActiveTheme(theme.Id);

            Assert.That(palette.ActiveTheme.Value, Is.EqualTo(theme));

            palette.RemoveTheme(theme.Id);

            Assert.That(palette.ActiveTheme.Value, Is.EqualTo(defaultTheme));
        }
Пример #10
0
        public void RestoreTheme_ThemeIsRestored()
        {
            var palette = new ColorPalette();
            var theme   = palette.AddTheme();

            Assert.That(palette.HasTheme(theme.Id), Is.True);

            palette.RemoveTheme(theme.Id);

            Assert.That(palette.HasTheme(theme.Id), Is.False);

            palette.RestoreTheme(theme.Id);

            Assert.That(palette.HasTheme(theme.Id), Is.True);
        }
Пример #11
0
        public void RestoreTheme_RemoveEntryAfterRemove_NoEntryIsCreated()
        {
            var palette = new ColorPalette();
            var theme   = palette.AddTheme();
            var entry   = palette.AddEntry();

            palette.RemoveTheme(theme.Id);

            Assert.That(palette.HasEntry(entry.Id), Is.True);

            palette.RemoveEntry(entry.Id);

            Assert.That(palette.HasEntry(entry.Id), Is.False);

            palette.RestoreTheme(theme.Id);

            Assert.That(palette.HasEntry(entry.Id), Is.False);
        }
Пример #12
0
        public void RestoreEntry_AddThemeAfterRemove_NewEntryHasValueForRestoredTheme()
        {
            var palette = new ColorPalette();
            var entry   = palette.AddEntry();

            Assert.That(palette.Entries.Count, Is.EqualTo(1));
            Assert.That(entry.Values.Count, Is.EqualTo(1));

            palette.RemoveEntry(entry.Id);

            Assert.That(palette.Entries.Count, Is.EqualTo(0));

            var theme = palette.AddTheme();

            var restoredEntry = palette.RestoreEntry(entry.Id);

            Assert.That(palette.Entries.Count, Is.EqualTo(1));
            Assert.That(restoredEntry.Values.Count, Is.EqualTo(2));
            Assert.That(restoredEntry.Values.ContainsKey(theme.Id), Is.True);
        }
Пример #13
0
        public void RestoreEntry_RemoveThemeAfterRemove_NoValueIsCreated()
        {
            var palette = new ColorPalette();
            var entry   = palette.AddEntry();
            var theme   = palette.AddTheme();

            Assert.That(palette.Entries.Count, Is.EqualTo(1));
            Assert.That(entry.Values.Count, Is.EqualTo(2));

            palette.RemoveEntry(entry.Id);

            Assert.That(palette.Entries.Count, Is.EqualTo(0));

            palette.RemoveTheme(theme.Id);

            var restoredEntry = palette.RestoreEntry(entry.Id);

            Assert.That(palette.Entries.Count, Is.EqualTo(1));
            Assert.That(restoredEntry.Values.Count, Is.EqualTo(1));
            Assert.That(restoredEntry.Values.ContainsKey(theme.Id), Is.False);
        }