public void CreateCollection() { IWebHostBuilder webhostbuilder = new WebHostBuilder() .UseEnvironment("Test") .UseStartup <TestStartup>(); using (TestServer server = new TestServer(webhostbuilder)) { PostmanCollectionCreator collectioncreator = new PostmanCollectionCreator("http://localhost:5000"); Collection collection = collectioncreator.Create(Guid.Empty, "Test", server.GetService <IApiDescriptionGroupCollectionProvider>()); Assert.AreNotEqual(0, collection.Item.Length); } }
public void QueryParametersAreAdded() { IWebHostBuilder webhostbuilder = new WebHostBuilder() .UseEnvironment("Test") .UseStartup <TestStartup>(); using (TestServer server = new TestServer(webhostbuilder)) { PostmanCollectionCreator collectioncreator = new PostmanCollectionCreator("http://localhost:5000"); Collection collection = collectioncreator.Create(Guid.Empty, "Test", server.GetService <IApiDescriptionGroupCollectionProvider>()); Assert.AreNotEqual(0, collection.Item.Length); RequestItem item = collection["Common.Simple.GetSomethingWithQuery"] as RequestItem; Assert.IsNotNull(item); Assert.AreEqual(1, item.Request.Url.Query.Length); Assert.AreEqual("parameter", item.Request.Url.Query[0].Key); } }
public void UserPasswordAuthentication() { IWebHostBuilder webhostbuilder = new WebHostBuilder() .UseEnvironment("Test") .UseStartup <TestStartup>(); using (TestServer server = new TestServer(webhostbuilder)) { PostmanCollectionCreator collectioncreator = new PostmanCollectionCreator("http://localhost:5000", new PasswordAuthenticationData { Server = "http://auth.localhost:5000/", Audience = "audience", ClientId = "clientid", Username = "******", Password = "******", Scope = "read:resource" }); Collection collection = collectioncreator.Create(Guid.Empty, "Test", server.GetService <IApiDescriptionGroupCollectionProvider>()); Assert.AreNotEqual(0, collection.Item.Length); Assert.IsTrue(collection.Item.Any(i => i.Name.StartsWith("Authenticate"))); } }