Beispiel #1
0
        public void GetReposForSourceReturnsList()
        {
            var source = new ConfigSource();

            source.Title = "title";

            var list = new List <HosterRepository>();

            list.Add(new HosterRepository("bar", "bar", "http://bar", ScmType.Git));
            list.Add(new HosterRepository("foo", "foo", "http://foo", ScmType.Git));

            var sut = new ApiRepositories();

            sut.AddItem(source, list);

            var result = sut.GetReposForSource(source);

            Assert.Equal(2, result.Count());
            Assert.Equal("bar", result.First().FullName);
        }
Beispiel #2
0
        public void GetReposForSourceReturnsAlphabeticallySorted()
        {
            var source = new ConfigSource();

            source.Title = "title";

            var list = new List <HosterRepository>();

            list.Add(new HosterRepository("ccc", "ccc", "http://ccc", ScmType.Git));
            list.Add(new HosterRepository("aaa", "aaa", "http://aaa", ScmType.Git));
            list.Add(new HosterRepository("bbb", "bbb", "http://bbb", ScmType.Git));

            var sut = new ApiRepositories();

            sut.AddItem(source, list);

            var result = sut.GetReposForSource(source).ToList();

            Assert.Equal("aaa", result[0].FullName);
            Assert.Equal("bbb", result[1].FullName);
            Assert.Equal("ccc", result[2].FullName);
        }