Skip to content

Commit

Permalink
Fixed unit tests failing on build server.
Browse files Browse the repository at this point in the history
Prepare for SemVer versioning to be generated on AppVeyor.
  • Loading branch information
natsnudasoft committed Sep 6, 2016
1 parent 4c70689 commit 0edf270
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 46 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ StyleCop.Cache
bin
obj
/OpenCover
/test/unit/TestResult.xml
/test/unit/coverage
/test/unit/results.xml
/tools/TestResult.xml
/tools/coverage
/tools/results.xml
/tools/coverage.xml
10 changes: 6 additions & 4 deletions AssemblyInfoCommon.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="AssemblyInfoCommon.cs" company="natsnudasoft">
// <copyright file="AssemblyInfoCommon.cs" company="natsnudasoft">
// Copyright (c) Adrian John Dunstan. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -20,6 +20,8 @@
[assembly: NeutralResourcesLanguage("en-GB")]
[assembly: AssemblyCompany("natsnudasoft")]
[assembly: AssemblyCopyright("Copyright © Adrian John Dunstan 2016")]
[assembly: AssemblyVersion("0.1")]
[assembly: AssemblyFileVersion("0.1.16249.17")]
[assembly: AssemblyInformationalVersion("0.1-beta")]

// Version is generated on the build server.
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0.0")]
5 changes: 5 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
assembly-versioning-scheme: MajorMinor
mode: ContinuousDelivery
branches: {}
ignore:
sha: []
20 changes: 20 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
environment:
COVERALLS_REPO_TOKEN:
secure: 01/8Z8oeHBp0GEYJhobtRFiPM/ZUSmkRLgu+BmxV8kgNP752XYu78DTqZB7xct3w
configuration: Release
platform: Any CPU
install:
- choco install gitversion.portable -y
before_build:
- cmd: nuget restore
- ps: gitversion /l console /output buildserver /updateassemblyinfo ..\AssemblyInfoCommon.cs /b (get-item env:APPVEYOR_REPO_BRANCH).Value
build:
project: AdiePlayground.sln
verbosity: minimal
after_test:
- cmd: packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -register:user "-filter:+[*]* -[Mehdime.Entity]* -[*Tests]*" -target:packages\NUnit.ConsoleRunner.3.4.1\tools\nunit3-console.exe -targetargs:test\unit\unit-tests.nunit -excludebyattribute:*.ExcludeFromCodeCoverage* -excludebyfile:*Designer.cs -output:coverage.xml
- cmd: packages\coveralls.io.1.3.4\tools\coveralls.net.exe --opencover coverage.xml
cache:
- packages -> **\packages.config
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml
7 changes: 0 additions & 7 deletions src/AdiePlayground/AdiePlayground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<AssemblyVersion>0.1.16249.17</AssemblyVersion>
<PrimaryVersionType>AssemblyFileVersionAttribute</PrimaryVersionType>
<AssemblyInfoFilePath>..\..\AssemblyInfoCommon.cs</AssemblyInfoFilePath>
<UpdateAssemblyVersion>False</UpdateAssemblyVersion>
<UpdateAssemblyFileVersion>True</UpdateAssemblyFileVersion>
<UpdateAssemblyInfoVersion>False</UpdateAssemblyInfoVersion>
<AssemblyFileVersionSettings>None.None.DateStamp.Increment</AssemblyFileVersionSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<NoWarn>
</NoWarn>
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
Expand Down
17 changes: 3 additions & 14 deletions test/unit/AdiePlayground.CommonTests/Iso3166CountryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ namespace AdiePlayground.CommonTests
public class Iso3166CountryTests
{
private const string ConstructorCountryCodeParam = "countryCode";
private const string RegionInfoNameParam = "name";

private static readonly IEnumerable<string> InvalidCountryCodes =
new[] { "Aa", "AA", "aa", string.Empty, "AAAA" };

private static readonly IEnumerable<KeyValuePair<string, string>> ValidCountries =
new[]
{
new KeyValuePair<string, string>("GB", "United Kingdom"),
new KeyValuePair<string, string>("gB", "United Kingdom"),
new KeyValuePair<string, string>("gb", "United Kingdom"),
new KeyValuePair<string, string>("Gb", "United Kingdom"),
new KeyValuePair<string, string>("PA", "Panama"),
Expand All @@ -47,9 +48,6 @@ public class Iso3166CountryTests
private static readonly IEnumerable<KeyValuePair<string, string>> ValidCountriesNoRegion =
new[]
{
new KeyValuePair<string, string>("AX", "Åland Islands"),
new KeyValuePair<string, string>("KP", "Korea"),
new KeyValuePair<string, string>("MG", "Madagascar"),
new KeyValuePair<string, string>("ZZ", "Unknown")
};

Expand All @@ -63,9 +61,6 @@ public class Iso3166CountryTests
{
var ex = Assert.Throws<ArgumentException>(() => new Iso3166Country(countryCode));
Assert.That(ex.ParamName, Is.EqualTo(ConstructorCountryCodeParam));
Assert.That(
ex.Message,
Does.StartWith(Common.Properties.Resources.Iso3166CountryCodeInvalid));
}

/// <summary>
Expand All @@ -76,9 +71,6 @@ public void Constructor_NullCountryCode_ArgumentNullException()
{
var ex = Assert.Throws<ArgumentNullException>(() => new Iso3166Country(null));
Assert.That(ex.ParamName, Is.EqualTo(ConstructorCountryCodeParam));
Assert.That(
ex.Message,
Does.StartWith(Common.Properties.Resources.Iso3166CountryCodeInvalid));
}

/// <summary>
Expand Down Expand Up @@ -125,10 +117,7 @@ public void Constructor_NullCountryCode_ArgumentNullException()
Assert.That(
country.CountryName,
Is.EqualTo(countryCode.Value).And.EqualTo(countryName));
Assert.That(ex.Message, Is.EqualTo(string.Format(
CultureInfo.InvariantCulture,
Properties.Resources.UnsupportedRegionInfo,
upperCountryCode)));
Assert.That(ex.ParamName, Is.EqualTo(RegionInfoNameParam));
}
}
}
1 change: 1 addition & 0 deletions test/unit/AdiePlayground.CommonTests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<packages>
<package id="Castle.Core" version="3.3.3" targetFramework="net462" />
<package id="codecracker.CSharp" version="1.0.0" targetFramework="net462" />
<package id="coveralls.io" version="1.3.4" targetFramework="net462" />
<package id="Menees.Analyzers" version="1.1.1.0" targetFramework="net462" />
<package id="Moq" version="4.5.21" targetFramework="net462" />
<package id="NUnit" version="3.4.1" targetFramework="net462" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public void Constructor_NullConnectionStringFactory_CreateContextCalled()
var ex = Assert.Throws<ArgumentNullException>(
() => new ConnectionStringDbContextFactory(null));
Assert.That(ex.ParamName, Is.EqualTo(ConstructorConnectionStringFactoryParam));
Assert.That(
ex.Message,
Does.StartWith(Data.Properties.Resources.ConnectionStringFactoryInvalid));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ public void Constructor_NullDbContextScopeFactory_ArgumentNullException()
{
var ex = Assert.Throws<ArgumentNullException>(() => new ContextService(null));
Assert.That(ex.ParamName, Is.EqualTo(ConstructorDbContextScopeFactoryParam));
Assert.That(
ex.Message,
Does.StartWith(Data.Properties.Resources.DbContextScopeFactoryInvalid));
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions test/unit/AdiePlayground.DataTests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<packages>
<package id="Castle.Core" version="3.3.3" targetFramework="net462" />
<package id="codecracker.CSharp" version="1.0.0" targetFramework="net462" />
<package id="coveralls.io" version="1.3.4" targetFramework="net462" />
<package id="EntityFramework" version="6.1.3" targetFramework="net462" />
<package id="Menees.Analyzers" version="1.1.1.0" targetFramework="net462" />
<package id="Moq" version="4.5.21" targetFramework="net462" />
Expand Down
11 changes: 0 additions & 11 deletions test/unit/run-test-reports.bat

This file was deleted.

11 changes: 11 additions & 0 deletions test/unit/unit-tests.nunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<NUnitProject>
<Settings activeconfig="Release"/>
<Config name="Debug">
<assembly path="AdiePlayground.CommonTests\bin\Debug\AdiePlayground.CommonTests.dll"/>
<assembly path="AdiePlayground.DataTests\bin\Debug\AdiePlayground.DataTests.dll"/>
</Config>
<Config name="Release">
<assembly path="AdiePlayground.CommonTests\bin\Release\AdiePlayground.CommonTests.dll"/>
<assembly path="AdiePlayground.DataTests\bin\Release\AdiePlayground.DataTests.dll"/>
</Config>
</NUnitProject>
3 changes: 3 additions & 0 deletions tools/run-test-reports.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
..\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -register:user "-filter:+[*]* -[Mehdime.Entity]* -[*Tests]*" -target:..\packages\NUnit.ConsoleRunner.3.4.1\tools\nunit3-console.exe -targetargs:..\test\unit\unit-tests.nunit -excludebyattribute:*.ExcludeFromCodeCoverage* -excludebyfile:*Designer.cs -output:coverage.xml && ^
..\packages\ReportGenerator.2.4.5.0\tools\ReportGenerator.exe -reports:results.xml -targetdir:coverage && ^
start coverage\index.htm

0 comments on commit 0edf270

Please sign in to comment.