Response status code does not indicate success: 500 (Internal Server Error).
This commit is contained in:
77
test/isn.tests/PushTest.cs
Normal file
77
test/isn.tests/PushTest.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Net.Http;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using isn.Abstract;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace isn.tests
|
||||
{
|
||||
public class Tests
|
||||
{
|
||||
private DataRow dataRow;
|
||||
|
||||
[Fact]
|
||||
public void HAveADefaultDataProtector()
|
||||
{
|
||||
string pass = "a lame and big pass";
|
||||
isn.IDataProtector _protector = new isn.DefaultDataProtector();
|
||||
string protectedpass = _protector.Protect(pass);
|
||||
string unprotectedpass = _protector.UnProtect(protectedpass);
|
||||
Console.WriteLine(protectedpass);
|
||||
Assert.Equal(pass, unprotectedpass);
|
||||
Assert.True(protectedpass!=null);
|
||||
Assert.True(protectedpass.Length>0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Test()
|
||||
{
|
||||
System.Data.DataTable dataTable = new System.Data.DataTable();
|
||||
dataTable.Columns.Add(new DataColumn("x"));
|
||||
dataTable.Columns.Add(new DataColumn("y"));
|
||||
dataRow = dataTable.NewRow();
|
||||
dataRow[0]= 1;
|
||||
dataRow[1]= 2;
|
||||
|
||||
dataTable.Rows.Add(dataRow);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestHttpClient()
|
||||
{
|
||||
string url = "http://localhost:88/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<ApiIndexViewModel>(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[] { "/home/paul/Nupkgs/Yavsc.Abstract.1.0.8.nupkg" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetServerResourcesUsingWebRequestAsyncTest()
|
||||
{
|
||||
var model = await SourceHelpers.GetServerResourcesUsingWebRequestAsync("Http://localhost:88/index.json");
|
||||
Console.WriteLine(JsonConvert.SerializeObject(model));
|
||||
Assert.NotNull(model.Resources);
|
||||
var pub = model.Resources.FirstOrDefault((r) => r.Type == "PackagePublish/2.0.0");
|
||||
Assert.True(pub!=null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user