private static void Main(string[] args) { var analysisService = new ApiPortService("https://portability.cloudapp.net", new ProductInformation("MyAPIQueryProgram")); Console.Write("Enter API you want to search for: "); var api = Console.ReadLine(); var matchingApis = FindMatchingApis(analysisService, api).Result; Console.WriteLine("Enter the number of the API you want to get more information about."); for (int i = 0; i < matchingApis.Count; i++) { Console.WriteLine("[" + i + "] " + matchingApis[i].FullName); } Console.Write("Enter api number: "); var index = int.Parse(Console.ReadLine()); var apiToSearchFor = matchingApis[index]; var apiInformation = GetApi(analysisService, apiToSearchFor.DocId).Result; Console.WriteLine("These are the platforms this API is supported on: "); foreach (var platform in apiInformation.Supported.Select(x => x.FullName)) { Console.WriteLine(platform); } Console.Write("Enter any key to quit..."); Console.ReadLine(); }
public ApiPortServiceTests() { var httpMessageHandler = new TestHandler(HttpRequestConverter); var productInformation = new ProductInformation("ApiPort_Tests"); //Create a fake ApiPortService which uses the TestHandler to send back the response message _apiPortService = new ApiPortService("http://localhost", httpMessageHandler, productInformation); }
public async Task ApiPortService_GetAvailableFormatsAsync(ApiPortService apiPortService, EndpointStatus expectedStatus) { var expected = new List<string> { "Json", "HTML", "Excel" }; var serviceResponse = await apiPortService.GetResultFormatsAsync(); var headers = serviceResponse.Headers; var result = serviceResponse.Response; Assert.Equal(expectedStatus, headers.Status); Assert.Equal(expected.Count(), result.Count()); Assert.Equal(0, expected.Except(result.Select(r => r.DisplayName)).Count()); }
public void ApiPortService_GetAvailableFormats() { var expected = new List<string> { "Json", "HTML", "Excel" }; var apiPortService = new ApiPortService( ServiceEndpoint, new ProductInformation("ApiPort_Tests", typeof(ApiPortServiceTests))); var result = apiPortService.GetResultFormatsAsync().Result.Response; Assert.Equal(expected.Count(), result.Count()); Assert.Equal(0, expected.Except(result.Select(r => r.DisplayName)).Count()); }
public void ApiPortService_GetAvailableFormats() { var expected = new List <string> { "Json", "HTML", "Excel" }; var apiPortService = new ApiPortService( ServiceEndpoint, new ProductInformation("ApiPort_Tests", typeof(ApiPortServiceTests))); var result = apiPortService.GetResultFormatsAsync().Result.Response; Assert.Equal(expected.Count(), result.Count()); Assert.Equal(0, expected.Except(result.Select(r => r.DisplayName)).Count()); }
public async Task ApiPortService_GetAvailableFormatsAsync(ApiPortService apiPortService, EndpointStatus expectedStatus) { var expected = new List <string> { "Json", "HTML", "Excel" }; var serviceResponse = await apiPortService.GetResultFormatsAsync(); var headers = serviceResponse.Headers; var result = serviceResponse.Response; Assert.Equal(expectedStatus, headers.Status); Assert.Equal(expected.Count(), result.Count()); Assert.Equal(0, expected.Except(result.Select(r => r.DisplayName)).Count()); }
public async Task ApiPortService_GetDocIdsWithValidDocIdAsync(ApiPortService apiPortService, EndpointStatus expectedStatus) { var docIds = new List<string> { "T:System.Console", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.Stream,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Object,System.Xml.Serialization.XmlSerializationWriter)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.Stream,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces,System.String)" }; var serviceResponse = await apiPortService.QueryDocIdsAsync(docIds); var headers = serviceResponse.Headers; var result = serviceResponse.Response; Assert.Equal(expectedStatus, headers.Status); Assert.Equal(docIds.Count(), result.Count()); Assert.Equal(0, docIds.Except(result.Select(r => r.Definition.DocId)).Count()); }
public void ApiPortService_GetDocIdsWithValidDocId() { var apiPortService = new ApiPortService( ServiceEndpoint, new ProductInformation("ApiPort_Tests", typeof(ApiPortServiceTests))); var docIds = new List<string> { "T:System.Console", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.Stream,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Object,System.Xml.Serialization.XmlSerializationWriter)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.Stream,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces,System.String)" }; var result = apiPortService.QueryDocIdsAsync(docIds).Result.Response; Assert.Equal(docIds.Count(), result.Count()); Assert.Equal(0, docIds.Except(result.Select(r => r.Definition.DocId)).Count()); }
public void ApiPortService_GetDocIdsWithValidDocId() { var apiPortService = new ApiPortService( ServiceEndpoint, new ProductInformation("ApiPort_Tests", typeof(ApiPortServiceTests))); var docIds = new List <string> { "T:System.Console", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.Stream,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Object,System.Xml.Serialization.XmlSerializationWriter)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.Stream,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces,System.String)" }; var result = apiPortService.QueryDocIdsAsync(docIds).Result.Response; Assert.Equal(docIds.Count(), result.Count()); Assert.Equal(0, docIds.Except(result.Select(r => r.Definition.DocId)).Count()); }
public async Task ApiPortService_GetDocIdsWithValidDocIdAsync(ApiPortService apiPortService, EndpointStatus expectedStatus) { var docIds = new List <string> { "T:System.Console", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.Stream,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Object,System.Xml.Serialization.XmlSerializationWriter)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.Stream,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces)", "M:System.Xml.Serialization.XmlSerializer.Serialize(System.Xml.XmlWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces,System.String)" }; var serviceResponse = await apiPortService.QueryDocIdsAsync(docIds); var headers = serviceResponse.Headers; var result = serviceResponse.Response; Assert.Equal(expectedStatus, headers.Status); Assert.Equal(docIds.Count(), result.Count()); Assert.Equal(0, docIds.Except(result.Select(r => r.Definition.DocId)).Count()); }