Exemplo n.º 1
0
        public void TestUpdate_Color()
        {
            var giteaApi  = new GiteaApi(null, null, "", "");
            var processor = new LabelDifferenceProcessor(giteaApi);

            var source = new List <Label>
            {
                new Label
                {
                    Id    = 123,
                    Name  = "label1",
                    Color = "ffffff"
                }
            };
            var configured = new List <Label>
            {
                new Label
                {
                    Name  = "label1",
                    Color = "ffff00"
                }
            };

            IReadOnlyList <LabelChangeStrategy> strategies = processor.Process(source, configured);

            Assert.AreEqual(1, strategies.Count);
            Assert.IsInstanceOfType(strategies[0], typeof(LabelChangeStrategy.Update <Label, GiteaApi>));
        }
Exemplo n.º 2
0
        public void TestDeletion()
        {
            var giteaApi  = new GiteaApi(null, null, "", "");
            var processor = new LabelDifferenceProcessor(giteaApi);

            var source = new List <Label>
            {
                new Label
                {
                    Name  = "label1",
                    Color = "ffffff"
                },
                new Label
                {
                    Id          = 123,
                    Name        = "label2",
                    Color       = "000000",
                    Description = "text"
                }
            };
            var configured = new List <Label>();

            IReadOnlyList <LabelChangeStrategy> strategies = processor.Process(source, configured);

            Assert.AreEqual(2, strategies.Count);
            Assert.IsInstanceOfType(strategies[0], typeof(LabelChangeStrategy.Remove <Label, GiteaApi>));
            Assert.IsInstanceOfType(strategies[1], typeof(LabelChangeStrategy.Remove <Label, GiteaApi>));
        }
Exemplo n.º 3
0
        public void TestSame()
        {
            var giteaApi  = new GiteaApi(null, null, "", "");
            var processor = new LabelDifferenceProcessor(giteaApi);

            var source = new List <Label>
            {
                new Label
                {
                    Name  = "label1",
                    Color = "ffffff"
                },
                new Label
                {
                    Id          = 123,
                    Name        = "label2",
                    Color       = "000000",
                    Description = "text"
                }
            };
            var configured = new List <Label>
            {
                new Label
                {
                    Name  = "label1",
                    Color = "ffffff"
                },
                new Label
                {
                    Name        = "label2",
                    Color       = "000000",
                    Description = "text"
                }
            };

            IReadOnlyList <LabelChangeStrategy> strategies = processor.Process(source, configured);

            Assert.AreEqual(0, strategies.Count);
        }