-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55f286a
commit 3465436
Showing
268 changed files
with
4,875 additions
and
5,075 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Net.Http.Json; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
@@ -8,8 +9,8 @@ namespace GZCTF.Test; | |
|
||
public class AccountTest : IClassFixture<TestWebAppFactory> | ||
{ | ||
private readonly TestWebAppFactory _factory; | ||
private readonly ITestOutputHelper _output; | ||
readonly TestWebAppFactory _factory; | ||
readonly ITestOutputHelper _output; | ||
|
||
public AccountTest(TestWebAppFactory factory, ITestOutputHelper output) | ||
{ | ||
|
@@ -20,35 +21,21 @@ public AccountTest(TestWebAppFactory factory, ITestOutputHelper output) | |
[Fact] | ||
public async Task TestCreateUser() | ||
{ | ||
using var client = _factory.CreateClient(); | ||
var registerResult = await client.PostAsJsonAsync("/api/account/register", new | ||
{ | ||
userName = "foo", | ||
password = "foo12345", | ||
email = "[email protected]", | ||
}); | ||
using HttpClient client = _factory.CreateClient(); | ||
HttpResponseMessage registerResult = await client.PostAsJsonAsync("/api/account/register", | ||
new { userName = "foo", password = "foo12345", email = "[email protected]" }); | ||
Assert.Equal(HttpStatusCode.BadRequest, registerResult.StatusCode); | ||
|
||
registerResult = await client.PostAsJsonAsync("/api/account/register", new | ||
{ | ||
userName = "foo", | ||
password = "foo12345##Foo", | ||
email = "[email protected]", | ||
}); | ||
registerResult = await client.PostAsJsonAsync("/api/account/register", | ||
new { userName = "foo", password = "foo12345##Foo", email = "[email protected]" }); | ||
Assert.True(registerResult.IsSuccessStatusCode); | ||
|
||
var loginResult = await client.PostAsJsonAsync("/api/account/login", new | ||
{ | ||
userName = "foo", | ||
password = "foo12345##" | ||
}); | ||
HttpResponseMessage loginResult = | ||
await client.PostAsJsonAsync("/api/account/login", new { userName = "foo", password = "foo12345##" }); | ||
Assert.False(loginResult.IsSuccessStatusCode); | ||
|
||
loginResult = await client.PostAsJsonAsync("/api/account/login", new | ||
{ | ||
userName = "foo", | ||
password = "foo12345##Foo" | ||
}); | ||
loginResult = | ||
await client.PostAsJsonAsync("/api/account/login", new { userName = "foo", password = "foo12345##Foo" }); | ||
Assert.True(loginResult.IsSuccessStatusCode); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
<CollectCoverage>true</CollectCoverage> | ||
<Configurations>Debug;Release;GenAPI</Configurations> | ||
<ReleaseVersion>0.17.1</ReleaseVersion> | ||
<EnablePreviewFeatures>True</EnablePreviewFeatures> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
<CollectCoverage>true</CollectCoverage> | ||
<Configurations>Debug;Release;GenAPI</Configurations> | ||
<ReleaseVersion>0.17.1</ReleaseVersion> | ||
<EnablePreviewFeatures>True</EnablePreviewFeatures> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.10" /> | ||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.10" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" /> | ||
<PackageReference Include="xunit" Version="2.5.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="xunit.runner.console" Version="2.5.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.msbuild" Version="6.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.10"/> | ||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.10"/> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2"/> | ||
<PackageReference Include="xunit" Version="2.5.0"/> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="xunit.runner.console" Version="2.5.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.msbuild" Version="6.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\GZCTF\GZCTF.csproj" /> | ||
<None Include="..\GZCTF\appsettings*" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\GZCTF\GZCTF.csproj"/> | ||
<None Include="..\GZCTF\appsettings*"/> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.