Skip to content
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
15 changes: 9 additions & 6 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,26 @@ $revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BU
$revision = "{0:D4}" -f [convert]::ToInt32($revision, 10)

dotnet restore
CheckLastExitCode

dotnet build ./src/Examples/GettingStarted/GettingStarted.csproj
dotnet build -c Release
CheckLastExitCode

dotnet test ./test/UnitTests/UnitTests.csproj
# Workaround: running 'dotnet test -c Release' fails for yet unknown reasons on AppVeyor, so we run tests one by one.

dotnet test ./test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj -c Release --no-build
CheckLastExitCode

dotnet test ./test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj
dotnet test ./test/DiscoveryTests/DiscoveryTests.csproj -c Release --no-build
CheckLastExitCode

dotnet test ./test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
dotnet test ./test/IntegrationTests/IntegrationTests.csproj -c Release --no-build
CheckLastExitCode

dotnet test ./test/DiscoveryTests/DiscoveryTests.csproj
dotnet test ./test/UnitTests/UnitTests.csproj -c Release --no-build
CheckLastExitCode

dotnet build ./src/JsonApiDotNetCore/JsonApiDotNetCore.csproj -c Release
dotnet test ./test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj -c Release --no-build
CheckLastExitCode

Write-Output "APPVEYOR_REPO_TAG: $env:APPVEYOR_REPO_TAG"
Expand Down
6 changes: 2 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
set -e

dotnet restore

dotnet test ./test/UnitTests/UnitTests.csproj
dotnet test ./test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj
dotnet test ./test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
dotnet build -c Release
dotnet test -c Release --no-build
3 changes: 2 additions & 1 deletion src/Examples/NoEntityFrameworkExample/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using JsonApiDotNetCore.Extensions;
using JsonApiDotNetCore.Services;
using Microsoft.AspNetCore.Builder;
Expand Down Expand Up @@ -42,7 +43,7 @@ public virtual void ConfigureServices(IServiceCollection services)
);
services.AddScoped<IResourceService<TodoItem>, TodoItemService>();
var optionsBuilder = new DbContextOptionsBuilder<AppDbContext>();
optionsBuilder.UseNpgsql(GetDbConnectionString());
optionsBuilder.UseNpgsql(GetDbConnectionString(), options => options.SetPostgresVersion(new Version(9,6)));
services.AddSingleton<IConfiguration>(Configuration);
services.AddSingleton(optionsBuilder.Options);
services.AddScoped<AppDbContext>();
Expand Down
17 changes: 0 additions & 17 deletions src/JsonApiDotNetCore/JsonApiDotNetCore.sln

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../../src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj" />
<ProjectReference Include="../UnitTests/UnitTests.csproj" />
<ProjectReference Include="..\..\src\JsonApiDotNetCore\JsonApiDotNetCore.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
28 changes: 28 additions & 0 deletions test/NoEntityFrameworkTests/TestScopedServiceProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using JsonApiDotNetCore.Services;
using Microsoft.AspNetCore.Http;
using Moq;

namespace NoEntityFrameworkTests
{
public class TestScopedServiceProvider : IScopedServiceProvider
{
private readonly IServiceProvider _serviceProvider;
private Mock<IHttpContextAccessor> _httpContextAccessorMock = new Mock<IHttpContextAccessor>();

public TestScopedServiceProvider(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}

public object GetService(Type serviceType)
{
if (serviceType == typeof(IHttpContextAccessor))
{
return _httpContextAccessorMock.Object;
}

return _serviceProvider.GetService(serviceType);
}
}
}
2 changes: 0 additions & 2 deletions test/NoEntityFrameworkTests/TestStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using NoEntityFrameworkExample;
using System;
using UnitTests;

namespace NoEntityFrameworkTests
{
Expand Down