示例#1
0
        public void TryParseRemoteUrl_returns_the_expected_GitHubProjectInfo(string url, string host, string @namespace, string projectName)
        {
            // ARRANGE
            var expected = new GitLabProjectInfo(host, @namespace, projectName);
            // ACT
            var success = GitLabUrlParser.TryParseRemoteUrl(url, out var projectInfo);

            // ASSERT
            Assert.True(success);
            Assert.Equal(expected, projectInfo);
        }
示例#2
0
        public void ParseRemoteUrl_returns_the_expected_GitLabProjectInfo(string remoteUrl, string host, string @namespace, string proejctName)
        {
            // ARRANGE
            var expected = new GitLabProjectInfo(host, @namespace, proejctName);

            // ACT
            var actual = GitLabUrlParser.ParseRemoteUrl(remoteUrl);

            // ASSERT
            Assert.Equal(expected, actual);
        }
示例#3
0
            public void Normalized_text_returns_expected_text(string currentOwner, string currentRepo, string referenceOwner, string referenceRepo, int referenceId, string expectedText)
            {
                // ARRANGE
                var currentProject = new GitLabProjectInfo("example.com", currentOwner, currentRepo);
                var reference      = new GitLabReference(new GitLabProjectInfo("example.com", referenceOwner, referenceRepo), GitLabReferenceType.Issue, referenceId);

                // ACT
                var sut = new GitLabReferenceTextElement("some-text", new("https://example.com"), currentProject, reference);

                // ASSERT
                Assert.Equal(expectedText, sut.NormalizedText);
            }
示例#4
0
            public void TryParse_fails_for_invalid_references(string input)
            {
                // ARRANGE
                var currentProject = new GitLabProjectInfo("example.com", "namespace", "project");

                // ACT
                var success = GitLabReference.TryParse(input, currentProject, out var result);

                // ASSERT
                Assert.False(success);
                Assert.Null(result);
            }
示例#5
0
            public void Id_must_not_be_zeo_or_negative(int id)
            {
                // ARRANGE
                var project = new GitLabProjectInfo("example.com", "user", "project");

                // ACT
                var ex = Record.Exception(() => new GitLabReference(project, GitLabReferenceType.Issue, id));

                // ASSERT
                var argumentOfRangeException = Assert.IsType <ArgumentOutOfRangeException>(ex);

                Assert.Equal("id", argumentOfRangeException.ParamName);
            }
示例#6
0
        public IEnumerable <(GitLabReference left, GitLabReference right)> GetEqualTestCases()
        {
            var project = new GitLabProjectInfo("example.com", "user", "project");

            yield return(
                new GitLabReference(project, GitLabReferenceType.Issue, 23),
                new GitLabReference(project, GitLabReferenceType.Issue, 23));

            yield return(
                new GitLabReference(project, GitLabReferenceType.MergeRequest, 23),
                new GitLabReference(project, GitLabReferenceType.MergeRequest, 23));

            yield return(
                new GitLabReference(project, GitLabReferenceType.Milestone, 23),
                new GitLabReference(project, GitLabReferenceType.Milestone, 23));
        }
示例#7
0
        public IEnumerable <(GitLabReference left, GitLabReference right)> GetUnequalTestCases()
        {
            var project1 = new GitLabProjectInfo("example.com", "user", "project1");
            var project2 = new GitLabProjectInfo("example.com", "user", "project2");

            yield return(
                new GitLabReference(project1, GitLabReferenceType.Issue, 23),
                new GitLabReference(project2, GitLabReferenceType.Issue, 23));

            yield return(
                new GitLabReference(project1, GitLabReferenceType.Issue, 23),
                new GitLabReference(project1, GitLabReferenceType.MergeRequest, 23));

            yield return(
                new GitLabReference(project1, GitLabReferenceType.Issue, 23),
                new GitLabReference(project1, GitLabReferenceType.Issue, 42));
        }