From 096f85716e9575d3f84472f53126ca93394b95e3 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 9 Jul 2017 21:50:06 +0200 Subject: [PATCH] Tests fixed --- Dockerfile | 7 ++++--- Dockerfile.test | 15 +++++++++++++++ .../Assets/FolderAssetStoreTests.cs | 13 +++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 Dockerfile.test diff --git a/Dockerfile b/Dockerfile index f83d9c808..5895e284f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,9 +46,10 @@ RUN cp -a /tmp/node_modules /src/Squidex/ \ # Test Backend RUN dotnet restore \ && dotnet test tests/Squidex.Infrastructure.Tests/Squidex.Infrastructure.Tests.csproj \ - && dotnet test tests/Squidex.Core.Tests/Squidex.Core.Tests.csproj \ - && dotnet test tests/Squidex.Read.Tests/Squidex.Read.Tests.csproj \ - && dotnet test tests/Squidex.Write.Tests/Squidex.Write.Tests.csproj + && dotnet test tests/Squidex.Domain.Apps.Core.Tests/Squidex.Domain.Apps.Core.Tests.csproj \ + && dotnet test tests/Squidex.Domain.Apps.Read.Tests/Squidex.Domain.Apps.Read.Tests.csproj \ + && dotnet test tests/Squidex.Domain.Apps.Write.Tests/Squidex.Domain.Apps.Write.Tests.csproj \ + && dotnet test tests/Squidex.Domain.Users.Tests/Squidex.Domain.Users.Tests.csproj # Publish RUN dotnet publish src/Squidex/Squidex.csproj --output /out/ --configuration Release diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 000000000..0520d0917 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,15 @@ +FROM microsoft/aspnetcore-build:1.1.2 + +COPY . . + +WORKDIR / + +# Test Backend +RUN dotnet restore \ + && dotnet test tests/Squidex.Infrastructure.Tests/Squidex.Infrastructure.Tests.csproj \ + && dotnet test tests/Squidex.Domain.Apps.Core.Tests/Squidex.Domain.Apps.Core.Tests.csproj \ + && dotnet test tests/Squidex.Domain.Apps.Read.Tests/Squidex.Domain.Apps.Read.Tests.csproj \ + && dotnet test tests/Squidex.Domain.Apps.Write.Tests/Squidex.Domain.Apps.Write.Tests.csproj \ + && dotnet test tests/Squidex.Domain.Users.Tests/Squidex.Domain.Users.Tests.csproj + +RUN ls /media/ \ No newline at end of file diff --git a/tests/Squidex.Infrastructure.Tests/Assets/FolderAssetStoreTests.cs b/tests/Squidex.Infrastructure.Tests/Assets/FolderAssetStoreTests.cs index af192e464..f789dce60 100644 --- a/tests/Squidex.Infrastructure.Tests/Assets/FolderAssetStoreTests.cs +++ b/tests/Squidex.Infrastructure.Tests/Assets/FolderAssetStoreTests.cs @@ -41,6 +41,12 @@ namespace Squidex.Infrastructure.Assets Assert.True(Directory.Exists(testFolder)); } + [Fact] + public void Should_throw_when_creating_directory_failed() + { + Assert.Throws(() => new FolderAssetStore(CreateInvalidPath(), new Mock().Object).Connect()); + } + [Fact] public Task Should_throw_exception_if_asset_not_found() { @@ -65,5 +71,12 @@ namespace Squidex.Infrastructure.Assets Assert.Equal(assetData.ToArray(), readData.ToArray()); } + + private static string CreateInvalidPath() + { + var windir = Environment.GetEnvironmentVariable("windir"); + + return !string.IsNullOrWhiteSpace(windir) ? "Z://invalid" : "/proc/invalid"; + } } }