Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration and perf tests to sln #9

Merged
merged 4 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<PackageVersion Include="Glob" Version="1.1.9" />
<PackageVersion Include="SimpleExec" Version="12.0.0" />
<PackageVersion Include="MongoDB.Driver" Version="2.19.2" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<GlobalPackageReference Include="PolySharp" Version="1.14.1" />
<GlobalPackageReference Include="MinVer" Version="5.0.0" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
Expand Down
7 changes: 7 additions & 0 deletions Speckle.Sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Transports.MongoDB"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Core.Serialization.Tests", "tests\Speckle.Core.Serialization.Tests\Speckle.Core.Serialization.Tests.csproj", "{AA1E1E51-49AE-4F71-84B1-938E19695BE0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Core.Tests.Integration", "tests\Speckle.Core.Tests.Integration\Speckle.Core.Tests.Integration.csproj", "{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -74,6 +76,10 @@ Global
{AA1E1E51-49AE-4F71-84B1-938E19695BE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA1E1E51-49AE-4F71-84B1-938E19695BE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA1E1E51-49AE-4F71-84B1-938E19695BE0}.Release|Any CPU.Build.0 = Release|Any CPU
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A413E196-3696-4F48-B635-04B5F76BF9C9} = {5CB96C27-FC5B-4A41-86B6-951AF99B8116}
Expand All @@ -84,5 +90,6 @@ Global
{9B8DDEB5-37C7-49B5-984D-C65DE5FCB7B7} = {58D37DA9-F948-48CA-9A73-F5BBBD533DBF}
{68078752-7C54-471A-9CB6-E8AEF34A9EFF} = {5CB96C27-FC5B-4A41-86B6-951AF99B8116}
{AA1E1E51-49AE-4F71-84B1-938E19695BE0} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void RemoveDirectory(string d)

Target(RESTORE, () => RunAsync("dotnet", "restore Speckle.Sdk.sln --locked-mode"));

Target(BUILD, DependsOn(RESTORE), () => RunAsync("dotnet", $"build Speckle.Sdk.sln -c Release --no-restore"));
Target(BUILD, DependsOn(RESTORE), () => RunAsync("dotnet", "build Speckle.Sdk.sln -c Release --no-restore"));

Target(
TEST,
Expand All @@ -55,7 +55,7 @@ void RemoveDirectory(string d)
}
);

Target(PACK, DependsOn(BUILD), () => RunAsync("dotnet", "pack Speckle.Sdk.sln -c Release -o output --no-build"));
Target(PACK, DependsOn(TEST), () => RunAsync("dotnet", "pack Speckle.Sdk.sln -c Release -o output --no-build"));

Target("default", DependsOn(FORMAT, TEST), () => Console.WriteLine("Done!"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ public async Task Setup()
[Test]
public async Task IsFrontEnd2True()
{
ServerInfo result = await AccountManager.GetServerInfo("https://app.speckle.systems/");
ServerInfo? result = await AccountManager.GetServerInfo("https://app.speckle.systems/");

Assert.That(result, Is.Not.Null);
Assert.That(result.frontend2, Is.True);
Assert.That(result?.frontend2, Is.True);
}

[Test]
public async Task IsFrontEnd2False()
{
ServerInfo result = await AccountManager.GetServerInfo("https://speckle.xyz/");
ServerInfo? result = await AccountManager.GetServerInfo("https://speckle.xyz/");

Assert.That(result, Is.Not.Null);
Assert.That(result.frontend2, Is.False);
Assert.That(result?.frontend2, Is.False);
}

/// <remarks>
Expand Down
11 changes: 6 additions & 5 deletions tests/Speckle.Core.Tests.Integration/Fixtures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Web;
using Newtonsoft.Json;
using Speckle.Core.Api;
using Speckle.Core.Common;
using Speckle.Core.Credentials;
using Speckle.Core.Logging;
using Speckle.Core.Models;
Expand Down Expand Up @@ -50,7 +51,7 @@ public static async Task<Account> SeedUser()
// $"{Server.url}/auth/local/register?challenge=challengingchallenge",
new StringContent(JsonConvert.SerializeObject(user), Encoding.UTF8, MediaTypeNames.Application.Json)
);
redirectUrl = response.Headers.Location!.AbsoluteUri;
redirectUrl = response.Headers.Location.NotNull().AbsoluteUri;
}
catch (Exception e)
{
Expand All @@ -74,13 +75,13 @@ public static async Task<Account> SeedUser()
"/auth/token",
new StringContent(JsonConvert.SerializeObject(tokenBody), Encoding.UTF8, MediaTypeNames.Application.Json)
);
var deserialised = JsonConvert.DeserializeObject<Dictionary<string, string>>(
await tokenResponse.Content.ReadAsStringAsync()
);
var deserialised = JsonConvert
.DeserializeObject<Dictionary<string, string>>(await tokenResponse.Content.ReadAsStringAsync())
.NotNull();

var acc = new Account
{
token = deserialised["token"]!,
token = deserialised["token"],
userInfo = new UserInfo
{
id = user["name"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<PropertyGroup Condition="'$(IsDesktopBuild)' == false">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" />
</ItemGroup>

<ItemGroup>

<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NUnit.Analyzers" Version="3.6.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\..\Core\Core.csproj" />
<ProjectReference Include="..\..\src\Speckle.Core\Speckle.Core.csproj" />
<ProjectReference Include="..\Speckle.Core.Tests.Unit\Speckle.Core.Tests.Unit.csproj" />
</ItemGroup>

</Project>
Loading
Loading