Skip to content

Commit e8728c5

Browse files
author
Petr Šrámek
committed
Test library updated to support .NET Standard 2.0
Test methods updated
1 parent 971b567 commit e8728c5

File tree

7 files changed

+112
-42
lines changed

7 files changed

+112
-42
lines changed

src/Cloudikka.PolylineAlgorithm/Cloudikka.PolylineAlgorithm.sln

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{51C886AF-D61
99
EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{576FEFFC-B624-40C3-A8AF-4E5233802EA0}"
1111
EndProject
12-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cloudikka.PolylineAlgorithm.Tests", "..\..\tests\Cloudikka.PolylineAlgorithm.Tests\Cloudikka.PolylineAlgorithm.Tests.csproj", "{5BA2C4BF-B107-456B-9463-7F1CD58ACC84}"
13-
EndProject
1412
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuget", "nuget", "{7F9807A1-01FF-40C3-9342-3F3F35D632DA}"
1513
ProjectSection(SolutionItems) = preProject
1614
..\..\nuget\Cloudikka.PolylineAlgorithm.nuspec = ..\..\nuget\Cloudikka.PolylineAlgorithm.nuspec
1715
EndProjectSection
1816
EndProject
17+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cloudikka.PolylineAlgorithm.Tests", "..\..\tests\Cloudikka.PolylineAlgorithm.Tests\Cloudikka.PolylineAlgorithm.Tests.csproj", "{1926DF66-E776-4369-AA0E-6A087F7137B5}"
18+
EndProject
1919
Global
2020
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2121
Debug|Any CPU = Debug|Any CPU
@@ -26,17 +26,17 @@ Global
2626
{882322A6-E758-4662-8D1C-7C555C8FC3F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
2727
{882322A6-E758-4662-8D1C-7C555C8FC3F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
2828
{882322A6-E758-4662-8D1C-7C555C8FC3F2}.Release|Any CPU.Build.0 = Release|Any CPU
29-
{5BA2C4BF-B107-456B-9463-7F1CD58ACC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30-
{5BA2C4BF-B107-456B-9463-7F1CD58ACC84}.Debug|Any CPU.Build.0 = Debug|Any CPU
31-
{5BA2C4BF-B107-456B-9463-7F1CD58ACC84}.Release|Any CPU.ActiveCfg = Release|Any CPU
32-
{5BA2C4BF-B107-456B-9463-7F1CD58ACC84}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{1926DF66-E776-4369-AA0E-6A087F7137B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{1926DF66-E776-4369-AA0E-6A087F7137B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{1926DF66-E776-4369-AA0E-6A087F7137B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
32+
{1926DF66-E776-4369-AA0E-6A087F7137B5}.Release|Any CPU.Build.0 = Release|Any CPU
3333
EndGlobalSection
3434
GlobalSection(SolutionProperties) = preSolution
3535
HideSolutionNode = FALSE
3636
EndGlobalSection
3737
GlobalSection(NestedProjects) = preSolution
3838
{882322A6-E758-4662-8D1C-7C555C8FC3F2} = {51C886AF-D610-48A4-9D73-2DEB38742801}
39-
{5BA2C4BF-B107-456B-9463-7F1CD58ACC84} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
39+
{1926DF66-E776-4369-AA0E-6A087F7137B5} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
4040
EndGlobalSection
4141
GlobalSection(ExtensibilityGlobals) = postSolution
4242
SolutionGuid = {93A268DC-0947-4FBB-B495-DDAD4B013D82}
Lines changed: 72 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,78 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props')" />
34
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
5-
6-
<IsPackable>false</IsPackable>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{1926DF66-E776-4369-AA0E-6A087F7137B5}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>Cloudikka.PolylineAlgorithm.Tests</RootNamespace>
11+
<AssemblyName>Cloudikka.PolylineAlgorithm.Tests</AssemblyName>
12+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
15+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
16+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
17+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
18+
<IsCodedUITest>False</IsCodedUITest>
19+
<TestProjectType>UnitTest</TestProjectType>
20+
<NuGetPackageImportStamp>
21+
</NuGetPackageImportStamp>
722
</PropertyGroup>
8-
23+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
24+
<DebugSymbols>true</DebugSymbols>
25+
<DebugType>full</DebugType>
26+
<Optimize>false</Optimize>
27+
<OutputPath>bin\Debug\</OutputPath>
28+
<DefineConstants>DEBUG;TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
33+
<DebugType>pdbonly</DebugType>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\Release\</OutputPath>
36+
<DefineConstants>TRACE</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
42+
<HintPath>..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
43+
</Reference>
44+
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
45+
<HintPath>..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
46+
</Reference>
47+
<Reference Include="System" />
48+
<Reference Include="System.Core" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<Compile Include="Defaults.cs" />
52+
<Compile Include="PolylineAlgorithmTest.cs" />
53+
<Compile Include="Properties\AssemblyInfo.cs" />
54+
<Compile Include="TuplePolylineDecoderTest.cs" />
55+
<Compile Include="TuplePolylineEncoderTest.cs" />
56+
</ItemGroup>
957
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
11-
<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
12-
<PackageReference Include="MSTest.TestFramework" Version="1.2.0" />
58+
<None Include="packages.config" />
1359
</ItemGroup>
14-
1560
<ItemGroup>
16-
<ProjectReference Include="..\..\src\Cloudikka.PolylineAlgorithm\Cloudikka.PolylineAlgorithm\Cloudikka.PolylineAlgorithm.csproj" />
61+
<ProjectReference Include="..\..\src\Cloudikka.PolylineAlgorithm\Cloudikka.PolylineAlgorithm\Cloudikka.PolylineAlgorithm.csproj">
62+
<Project>{882322a6-e758-4662-8d1c-7c555c8fc3f2}</Project>
63+
<Name>Cloudikka.PolylineAlgorithm</Name>
64+
</ProjectReference>
1765
</ItemGroup>
18-
19-
</Project>
66+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
67+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
68+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
69+
<PropertyGroup>
70+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
71+
</PropertyGroup>
72+
<Error Condition="!Exists('..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props'))" />
73+
<Error Condition="!Exists('..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets'))" />
74+
<Error Condition="!Exists('..\..\src\Cloudikka.PolylineAlgorithm\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\src\Cloudikka.PolylineAlgorithm\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets'))" />
75+
</Target>
76+
<Import Project="..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\src\Cloudikka.PolylineAlgorithm\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets')" />
77+
<Import Project="..\..\src\Cloudikka.PolylineAlgorithm\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\..\src\Cloudikka.PolylineAlgorithm\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets')" />
78+
</Project>

tests/Cloudikka.PolylineAlgorithm.Tests/PolylineAlgorithmTest.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public class PolylineAlgorithmTest {
1919
/// The Decode_EmptyInput
2020
/// </summary>
2121
[TestMethod]
22-
[ExpectedException(typeof(ArgumentException))]
2322
public void Decode_EmptyInput() {
2423
Assert.ThrowsException<ArgumentException>(() => PolylineAlgorithm.Decode(String.Empty.ToCharArray()));
2524
}
@@ -28,11 +27,8 @@ public void Decode_EmptyInput() {
2827
/// The Decode_InvalidInput
2928
/// </summary>
3029
[TestMethod]
31-
[ExpectedException(typeof(InvalidOperationException))]
3230
public void Decode_InvalidInput() {
33-
var result = PolylineAlgorithm.Decode(Defaults.InvalidPolyline.ToCharArray());
34-
35-
Assert.AreEqual(Defaults.InvalidCoordinates, result);
31+
Assert.ThrowsException<InvalidOperationException>(() => PolylineAlgorithm.Decode(Defaults.InvalidPolyline.ToCharArray()));
3632
}
3733

3834
/// <summary>
@@ -57,7 +53,6 @@ public void Decode_ValidInput() {
5753
/// The Encode_EmptyInput
5854
/// </summary>
5955
[TestMethod]
60-
[ExpectedException(typeof(ArgumentException))]
6156
public void Encode_EmptyInput() {
6257
Assert.ThrowsException<ArgumentException>(() => PolylineAlgorithm.Encode(Defaults.EmptyCoordinates));
6358
}
@@ -66,11 +61,8 @@ public void Encode_EmptyInput() {
6661
/// The Encode_InvalidInput
6762
/// </summary>
6863
[TestMethod]
69-
[ExpectedException(typeof(InvalidOperationException))]
7064
public void Encode_InvalidInput() {
71-
var result = PolylineAlgorithm.Encode(Defaults.InvalidCoordinates);
72-
73-
Assert.AreEqual(Defaults.InvalidPolyline, result);
65+
Assert.ThrowsException<InvalidOperationException>(() => PolylineAlgorithm.Encode(Defaults.InvalidCoordinates));
7466
}
7567

7668
/// <summary>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
[assembly: AssemblyTitle("Cloudikka.PolylineAlgorithm.Tests")]
6+
[assembly: AssemblyDescription("")]
7+
[assembly: AssemblyConfiguration("")]
8+
[assembly: AssemblyCompany("")]
9+
[assembly: AssemblyProduct("Cloudikka.PolylineAlgorithm.Tests")]
10+
[assembly: AssemblyCopyright("Copyright © 2017")]
11+
[assembly: AssemblyTrademark("")]
12+
[assembly: AssemblyCulture("")]
13+
14+
[assembly: ComVisible(false)]
15+
16+
[assembly: Guid("1926df66-e776-4369-aa0e-6a087f7137b5")]
17+
18+
// [assembly: AssemblyVersion("1.0.*")]
19+
[assembly: AssemblyVersion("1.0.0.0")]
20+
[assembly: AssemblyFileVersion("1.0.0.0")]

tests/Cloudikka.PolylineAlgorithm.Tests/TuplePolylineDecoderTest.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace Cloudikka.PolylineAlgorithm.Tests {
77
using System;
8+
using System.Linq;
89
using Microsoft.VisualStudio.TestTools.UnitTesting;
910

1011
/// <summary>
@@ -27,7 +28,6 @@ public class TuplePolylineDecoderTest {
2728
/// The Decoder_Decode_EmptyInput
2829
/// </summary>
2930
[TestMethod]
30-
[ExpectedException(typeof(ArgumentException))]
3131
public void Decoder_Decode_EmptyInput() {
3232
Assert.ThrowsException<ArgumentException>(() => _decoder.Decode(Defaults.EmptyPolyline));
3333
}
@@ -36,11 +36,8 @@ public void Decoder_Decode_EmptyInput() {
3636
/// The Decoder_Decode_InvalidInput
3737
/// </summary>
3838
[TestMethod]
39-
[ExpectedException(typeof(InvalidOperationException))]
4039
public void Decoder_Decode_InvalidInput() {
41-
var result = _decoder.Decode(Defaults.InvalidPolyline);
42-
43-
Assert.AreEqual(Defaults.InvalidCoordinates, result);
40+
Assert.ThrowsException<InvalidOperationException>(() => _decoder.Decode(Defaults.InvalidPolyline));
4441
}
4542

4643
/// <summary>
@@ -58,7 +55,7 @@ public void Decoder_Decode_NullInput() {
5855
public void Decoder_Decode_ValidInput() {
5956
var result = _decoder.Decode(Defaults.ValidPolyline);
6057

61-
Assert.AreEqual(Defaults.ValidPolyline, result);
58+
CollectionAssert.AreEquivalent(Defaults.ValidCoordinates.ToList(), result.ToList());
6259
}
6360

6461
#endregion

tests/Cloudikka.PolylineAlgorithm.Tests/TuplePolylineEncoderTest.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public class TuplePolylineEncoderTest {
2828
/// The Encoder_Encode_EmptyInput
2929
/// </summary>
3030
[TestMethod]
31-
[ExpectedException(typeof(ArgumentException))]
3231
public void Encoder_Encode_EmptyInput() {
3332
Assert.ThrowsException<ArgumentException>(() => _encoder.Encode(Enumerable.Empty<(double, double)>()));
3433
}
@@ -37,18 +36,14 @@ public void Encoder_Encode_EmptyInput() {
3736
/// The Encoder_Encode_InvalidInput
3837
/// </summary>
3938
[TestMethod]
40-
[ExpectedException(typeof(InvalidOperationException))]
4139
public void Encoder_Encode_InvalidInput() {
42-
var result = _encoder.Encode(Defaults.InvalidCoordinates);
43-
44-
Assert.AreEqual(Defaults.InvalidPolyline, result);
40+
Assert.ThrowsException<InvalidOperationException>(() => _encoder.Encode(Defaults.InvalidCoordinates));
4541
}
4642

4743
/// <summary>
4844
/// The Encoder_Encode_NullInput
4945
/// </summary>
5046
[TestMethod]
51-
[ExpectedException(typeof(ArgumentException))]
5247
public void Encoder_Encode_NullInput() {
5348
Assert.ThrowsException<ArgumentException>(() => _encoder.Encode(null));
5449
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Microsoft.NETCore.Platforms" version="2.0.1" targetFramework="net461" />
4+
<package id="MSTest.TestAdapter" version="1.2.0" targetFramework="net461" />
5+
<package id="MSTest.TestFramework" version="1.2.0" targetFramework="net461" />
6+
<package id="NETStandard.Library" version="2.0.1" targetFramework="net461" />
7+
</packages>

0 commit comments

Comments
 (0)