public void TestUpdate_Color() { var githubApi = new GithubApi(null, null, "", ""); var processor = new LabelDifferenceProcessor(githubApi); var source = new List <Label> { new Label { 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, GithubApi>)); }
public void TestDeletion() { var githubApi = new GithubApi(null, null, "", ""); var processor = new LabelDifferenceProcessor(githubApi); var source = new List <Label> { new Label { Name = "label1", Color = "ffffff" }, new Label { 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, GithubApi>)); Assert.IsInstanceOfType(strategies[1], typeof(LabelChangeStrategy.Remove <Label, GithubApi>)); }
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); }