using System; using System.Net.Http; using System.Threading.Tasks; using Newtonsoft.Json; using isn.Abstract; using System.Linq; using Xunit; using isn.abst; namespace isn.tests { public class Tests { [Fact] public async Task TestHttpClient() { string url = "https://isn.pschneider.fr"+Constants.ApiVersionPrefix+"/index.json" ; HttpClient client = new HttpClient(); // var json = await client.GetStringAsync(new System.Uri(url)); var response = await client.GetAsync(url); var json = await response.Content.ReadAsStringAsync(); var vm = JsonConvert.DeserializeObject(json); Console.WriteLine(JsonConvert.SerializeObject(vm)); Assert.NotNull(vm); Assert.NotNull(vm.Resources); } [Fact] public void TestPush() { Program.LoadConfig(); var report = Program.PushPkg(new string[] { "./src/isn.abst/bin/Debug/isn.abst.1.0.1.nupkg" + Constants.PacketFileExtension }); } [Fact] public void GetServerResourcesUsingHttpClientAsyncTest() { var model = SourceHelpers.GetServerResources("Https://isn.pschneider.fr/v3/index"); Console.WriteLine(JsonConvert.SerializeObject(model)); Assert.NotNull(model.Resources); var pub = model.Resources.FirstOrDefault((r) => r.Type.StartsWith("PackagePublish/")); Assert.True(pub != null); } } }