Skip to content

Commit

Permalink
start test (xUnit) Infrastructure
Browse files Browse the repository at this point in the history
- added first test project to the solution
- following some pattern identified in https://github.com/dotnet or BaGet
    - multiple test-csproj inside a folder "test(s)"
    - BaGet uses CamelCase for FolderName => "Tests" not "tests"
    - plural for tests ?
- in github/dotnet the "test" folde sometimes is brother of "src", sometimes is child of "src" => child of src selected!
-one xUnit -csproj per implementation-csproj
-use suffix ".Tests" for file, folder and default-namespace

implementation => tests
-----------------------------------------
src/BaGet.Core.csproj  => src/Tests/Baget.Core.Tests.csproj
  • Loading branch information
WernerMairl committed Jul 1, 2018
1 parent 03ead05 commit e5ed8ca
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
6 changes: 6 additions & 0 deletions BaGet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet.Tools.ImportDownloads
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet.Tools.AzureSearchImporter", "src\BaGet.Tools.AzureSearchImporter\BaGet.Tools.AzureSearchImporter.csproj", "{B232DAFE-5CE8-441F-ACC7-2BB54BCD094F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet.Core.Tests", "src\Tests\BaGet.Core.Tests\BaGet.Core.Tests.csproj", "{89AB1AE2-6CAA-4809-8B74-D78CBE00B049}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -45,6 +47,10 @@ Global
{B232DAFE-5CE8-441F-ACC7-2BB54BCD094F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B232DAFE-5CE8-441F-ACC7-2BB54BCD094F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B232DAFE-5CE8-441F-ACC7-2BB54BCD094F}.Release|Any CPU.Build.0 = Release|Any CPU
{89AB1AE2-6CAA-4809-8B74-D78CBE00B049}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89AB1AE2-6CAA-4809-8B74-D78CBE00B049}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89AB1AE2-6CAA-4809-8B74-D78CBE00B049}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89AB1AE2-6CAA-4809-8B74-D78CBE00B049}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
20 changes: 20 additions & 0 deletions src/Tests/BaGet.Core.Tests/BaGet.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\BaGet.Core\BaGet.Core.csproj" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions src/Tests/BaGet.Core.Tests/FilePackageStorageServiceTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using Xunit;
using BaGet.Core.Services;
using System.IO;

namespace BaGet.Core.Tests
{
public class FilePackageStorageServiceTests
{
[Fact]
public void Create_On_Not_Existing_Folder()
{
string validButNotExistingPath = Path.Combine(Path.GetTempPath(), System.Guid.NewGuid().ToString("N"));
Assert.False(Directory.Exists(validButNotExistingPath));
IPackageStorageService service = new FilePackageStorageService(validButNotExistingPath);
}
}
}

0 comments on commit e5ed8ca

Please sign in to comment.