public void UrlObjectConverter_ProducesExpectedRawUrlFromHostBasePathAndPath(string host, string basePath, string path, string expectedRawUrl) { UrlObjectConverter converter = new UrlObjectConverter(new DefaultValueFactory()); PostmanUrl result = converter.Convert(path, new List <IParameter>(), host, basePath); Assert.Equal(expectedRawUrl, result.Raw); }
public void UrlObjectConverter_ProducesExpectedHost(string host, string expectedhost) { UrlObjectConverter converter = new UrlObjectConverter(new DefaultValueFactory()); PostmanUrl result = converter.Convert(_validPath, _validParameters, host, _validPath); Assert.Equal(expectedhost, result.Host); }
public void UrlObjectConverter_ProducesExpectedRawUrl() { UrlObjectConverter converter = new UrlObjectConverter(new DefaultValueFactory()); PostmanUrl result = converter.Convert(_validPath, _validParameters, _validHost, _validBasePath); Assert.Equal("http://mysite.com/api/Values/postFormDataEndpoint/:id?filter={{filter}}&page={{page}}", result.Raw); }
public void UrlObjectConverter_ProducesExpectedPathSegments(string basepath, string path, string[] expectedSegments) { UrlObjectConverter converter = new UrlObjectConverter(new DefaultValueFactory()); PostmanUrl result = converter.Convert(path, new List <IParameter>(), _validHost, basepath); Assert.Equal(expectedSegments, result.Path); }
public void UrlObjectConverter_ProducesExpectedPath() { UrlObjectConverter converter = new UrlObjectConverter(new DefaultValueFactory()); PostmanUrl result = converter.Convert(_validPath, _validParameters, _validHost, _validBasePath); Assert.Equal(new string[] { "api", "Values", "postFormDataEndpoint", ":id" }, result.Path); }
public void UrlObjectConverter_ProducesTheSameNumberOfVariablesAsUrlParameters() { int expectedTotal = _validParameters.Count(p => p.In == SwashbuckleParameterTypeConstants.Query || p.In == SwashbuckleParameterTypeConstants.Path); UrlObjectConverter converter = new UrlObjectConverter(new DefaultValueFactory()); PostmanUrl result = converter.Convert(_validPath, _validParameters, _validHost, _validBasePath); Assert.Equal(expectedTotal, result.Variables.Count); }
public void UrlObjectConverter_ProducesCorrectQueryParameters() { int expectedTotal = _validParameters.Count(p => p.In == SwashbuckleParameterTypeConstants.Query); UrlObjectConverter converter = new UrlObjectConverter(new DefaultValueFactory()); PostmanUrl result = converter.Convert(_validPath, _validParameters, _validHost, _validBasePath); foreach (PostmanQueryParam resultParam in result.QueryParams) { Assert.NotNull(resultParam.Key); Assert.NotNull(resultParam.Value); Assert.NotNull(resultParam.Description); var sourceParam = _validParameters.First(x => x.Name == resultParam.Key); Assert.Equal(sourceParam.Name, resultParam.Key); Assert.Equal(resultParam.Description.Content, sourceParam.Description); } }