This commit is contained in:
2022-04-11 19:57:30 +01:00
parent ee07affbbd
commit 6d21d7370c
5 changed files with 34 additions and 13 deletions

View File

@ -4,11 +4,11 @@ using System.IO;
using System.Xml; using System.Xml;
using System.Net.Http; using System.Net.Http;
using NUnit.Framework;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
using isn.Abstract; using isn.Abstract;
using System.Linq; using System.Linq;
using Xunit;
namespace isn.tests namespace isn.tests
{ {
@ -16,7 +16,7 @@ namespace isn.tests
{ {
private DataRow dataRow; private DataRow dataRow;
[Test] [Fact]
public void HAveADefaultDataProtector() public void HAveADefaultDataProtector()
{ {
string pass = "a lame and big pass"; string pass = "a lame and big pass";
@ -24,11 +24,12 @@ namespace isn.tests
string protectedpass = _protector.Protect(pass); string protectedpass = _protector.Protect(pass);
string unprotectedpass = _protector.UnProtect(protectedpass); string unprotectedpass = _protector.UnProtect(protectedpass);
Console.WriteLine(protectedpass); Console.WriteLine(protectedpass);
Assert.AreEqual(pass, unprotectedpass); Assert.Equal(pass, unprotectedpass);
Assert.Pass($"Good jod man! (decoding {protectedpass})"); Assert.True(protectedpass!=null);
Assert.True(protectedpass.Length>0);
} }
[Test] [Fact]
public void Test() public void Test()
{ {
System.Data.DataTable dataTable = new System.Data.DataTable(); System.Data.DataTable dataTable = new System.Data.DataTable();
@ -42,7 +43,7 @@ dataTable.Rows.Add(dataRow);
} }
[Test] [Fact]
public async Task TestHttpClient() public async Task TestHttpClient()
{ {
string url = "http://localhost:88/index.json"; string url = "http://localhost:88/index.json";
@ -55,14 +56,14 @@ dataTable.Rows.Add(dataRow);
Assert.NotNull(vm); Assert.NotNull(vm);
Assert.NotNull(vm.Resources); Assert.NotNull(vm.Resources);
} }
[Test] [Fact]
public async Task TestPush() public async Task TestPush()
{ {
Program.LoadConfig(); Program.LoadConfig();
var report = await Program.PushPkgAsync(new string[] { "bin/Debug/isn.1.0.1.nupkg" }); var report = await Program.PushPkgAsync(new string[] { "bin/Debug/isn.1.0.1.nupkg" });
} }
[Test] [Fact]
public async Task GetServerResourcesUsingWebRequestAsyncTest() public async Task GetServerResourcesUsingWebRequestAsyncTest()
{ {
var model = await SourceHelpers.GetServerResourcesUsingWebRequestAsync("Http://localhost:88/index.json"); var model = await SourceHelpers.GetServerResourcesUsingWebRequestAsync("Http://localhost:88/index.json");

View File

@ -1,16 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net45</TargetFrameworks> <TargetFrameworks>net6</TargetFrameworks>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="coverlet.collector" Version="3.0.2" /> <PackageReference Include="coverlet.collector" Version="3.0.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.runner.reporters" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageToolReference Include="xunit.runner.console" Version="2.4.1" PrivateAssets="All"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,13 @@
using Xunit;
namespace isn.tests
{
public class xunitTest1
{
[Fact]
void Test1()
{
}
}
}

View File

@ -16,7 +16,6 @@ namespace isnd.host.tests
const string testingUrl = "http://localhost:5000"; const string testingUrl = "http://localhost:5000";
[Fact]
public void TestHaveTestDbContextAndMigrate() public void TestHaveTestDbContextAndMigrate()
{ {
string envVar = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); string envVar = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");

View File

@ -10,9 +10,11 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="xunit" Version="2.4.0" /> <PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.runner.reporters" Version="2.4.1" /> <PackageReference Include="xunit.runner.reporters" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.runner.msbuild" Version="2.4.1" />
<PackageToolReference Include="xunit.runner.console" Version="2.4.1" PrivateAssets="All"/> <PackageToolReference Include="xunit.runner.console" Version="2.4.1" PrivateAssets="All"/>
<PackageReference Include="coverlet.collector" Version="1.2.0" /> <PackageReference Include="coverlet.collector" Version="1.2.0" />