public IActionResult GetWizardInformation(Uri sourceURI) { if (sourceURI == null) { ProblemDetails problem = new ProblemDetails { Title = "Source uri is null or empty.", Detail = "The incoming source uri is not valid.", Instance = "6D63D9FA-91D6-42D5-9ACB-461FBEB0D2ED" }; return(BadRequest(problem)); } Project project = sourceManagerService.FetchProject(sourceURI); if (project == null) { return(NotFound()); } if (project.Name == null && project.ShortDescription == null && project.Description == null) { ProblemDetails problem = new ProblemDetails { Title = "Project not found.", Detail = "The incoming source uri aims at a gitlab which is either not instantiated or is a group.", Instance = "E56D89C5-8760-4503-839C-F695092C79BF" }; return(BadRequest(problem)); } return(Ok(project)); }
public void FetchProject_goodflow_matches_gitlab() { Project project = new Project(); project.Name = "test project"; project.Description = "readme content"; project.ShortDescription = "project readme"; project.Uri = "website url"; gitLabMock.Setup(r => r.ProjectURIMatches(It.IsAny <Uri>())) .Returns(true); gitLabMock.Setup(r => r.GetProjectInformation(It.IsAny <Uri>())) .Returns(project); Project projectresult = sourceManagerService.FetchProject(new Uri("http://example.com")); Assert.AreEqual(project, projectresult); }