Merge pull request #580 from collinbarrett/issue132

Add first unit test and run with Travis CI
This commit is contained in:
Collin M. Barrett 2018-10-13 02:20:43 +00:00 committed by GitHub
commit 5c5e3a085c
4 changed files with 49 additions and 0 deletions

View file

@ -9,6 +9,7 @@ addons:
- sshpass
script:
- scripts/build.sh
- dotnet test tests/FilterLists.Services.Tests/FilterLists.Services.Tests.csproj
env:
global:
#FTP_USER

View file

@ -48,6 +48,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sql", "sql", "{A4BB2C81-523
scripts\sql\snapshotTimeAnalysis.sql = scripts\sql\snapshotTimeAnalysis.sql
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FilterLists.Services.Tests", "tests\FilterLists.Services.Tests\FilterLists.Services.Tests.csproj", "{7D9F0D85-E906-401A-BDAD-724440B34567}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -74,6 +76,10 @@ Global
{4F39D132-498D-4A93-9F6C-1C604718300D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F39D132-498D-4A93-9F6C-1C604718300D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F39D132-498D-4A93-9F6C-1C604718300D}.Release|Any CPU.Build.0 = Release|Any CPU
{7D9F0D85-E906-401A-BDAD-724440B34567}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D9F0D85-E906-401A-BDAD-724440B34567}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D9F0D85-E906-401A-BDAD-724440B34567}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D9F0D85-E906-401A-BDAD-724440B34567}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -0,0 +1,20 @@
using System.Collections.ObjectModel;
using FilterLists.Services.Extensions;
using Xunit;
namespace FilterLists.Services.Tests.Extensions
{
public class AddIfNotNullOrEmptyShould
{
[Fact]
public void AddIfNotNullOrEmpty()
{
var sut = new Collection<string>();
const string item = "item";
sut.AddIfNotNullOrEmpty(item);
Assert.Contains(item, sut);
}
}
}

View file

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\FilterLists.Services\FilterLists.Services.csproj" />
</ItemGroup>
</Project>