public async Task <IHttpActionResult> GetURLSegment() { try { var urlSegment = _groupLeaderService.GetUrlSegment().Wait(); return(Ok(new { url = urlSegment })); } catch (Exception e) { var apiError = new ApiErrorDto("Getting Url Segment Failed: ", e); throw new HttpResponseException(apiError.HttpResponseMessage); } }
public void ShouldGetURLSegment() { const string appCode = "appCode"; const string fieldName = "fieldName"; const string urlSegment = "/group-leader"; _configWrapper.Setup(m => m.GetConfigValue("GroupLeaderAppCode")).Returns(appCode); _configWrapper.Setup(m => m.GetConfigValue("GroupLeaderApplicationUrlSegment")).Returns(fieldName); _configWrapper.Setup(m => m.GetMpConfigValue(appCode, fieldName, true)).Returns(urlSegment); var response = _fixture.GetUrlSegment(); response.Subscribe((n) => { Assert.AreEqual(urlSegment, response); }, (err) => { Assert.Fail(err.ToString()); }); }