Ejemplo n.º 1
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);
            }
Ejemplo n.º 2
0
            public void TryParse_throws_ArgumentNullException_when_current_project_is_null()
            {
                // ARRANGE

                // ACT
                var ex = Record.Exception(() => GitLabReference.TryParse("#23", null !, out var result));

                // ASSERT
                var argumentNullException = Assert.IsType <ArgumentNullException>(ex);

                Assert.Equal("currentProject", argumentNullException.ParamName);
            }
Ejemplo n.º 3
0
            public void TryParse_returns_expected_reference(string input, string currentNamespace, string currentProject, string expectedNamespace, string expectedProject, GitLabReferenceType expectedType, int expectedId)
            {
                // ARRANGE

                // ACT
                var success = GitLabReference.TryParse(input, new("example.com", currentNamespace, currentProject), out var parsed);

                // ASSERT
                Assert.True(success);
                Assert.Equal("example.com", parsed !.Project.Host);
                Assert.Equal(expectedNamespace, parsed.Project.Namespace);
                Assert.Equal(expectedProject, parsed.Project.Project);
                Assert.Equal(expectedType, parsed.Type);
                Assert.Equal(expectedId, parsed.Id);
            }