Skip to content

Commit

Permalink
Merge pull request #105 from MannusEtten/v1.2
Browse files Browse the repository at this point in the history
V1.2
  • Loading branch information
Mannus Etten committed Feb 27, 2018
2 parents 00f9bf3 + 426db96 commit c89e03b
Show file tree
Hide file tree
Showing 251 changed files with 59,207 additions and 57,943 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -17,6 +17,7 @@
[Rr]eleases/
x64/
x86/
packages/
build/
bld/
[Bb]in/
Expand Down
Expand Up @@ -36,34 +36,48 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.1.0\lib\net45\Castle.Core.dll</HintPath>
<Reference Include="Castle.Core, Version=4.1.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.1.1\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="CommonServiceLocator, Version=2.0.2.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\packages\CommonServiceLocator.2.0.2\lib\net45\CommonServiceLocator.dll</HintPath>
</Reference>
<Reference Include="Esri.ArcGISRuntime, Version=10.2.7.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\ArcGIS\runtime\DotNet10.2.7\WindowsDesktop\bin\Esri.ArcGISRuntime.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions, Version=4.19.3.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.3\lib\net45\FluentAssertions.dll</HintPath>
<Reference Include="FluentAssertions, Version=4.19.4.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.4\lib\net45\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.19.4.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.4\lib\net45\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.19.3.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.3\lib\net45\FluentAssertions.Core.dll</HintPath>
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.4.1.0, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616" />
<Reference Include="Moq, Version=4.7.63.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.7.63\lib\net45\Moq.dll</HintPath>
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.7.99.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.7.99\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="Ploeh.AutoFixture, Version=3.50.0.0, Culture=neutral, PublicKeyToken=b24654c590009d4f, processorArchitecture=MSIL">
<HintPath>..\packages\AutoFixture.3.50.3\lib\net40\Ploeh.AutoFixture.dll</HintPath>
<HintPath>..\packages\AutoFixture.3.50.6\lib\net40\Ploeh.AutoFixture.dll</HintPath>
</Reference>
<Reference Include="Ploeh.AutoFixture.AutoMoq, Version=3.50.0.0, Culture=neutral, PublicKeyToken=b24654c590009d4f, processorArchitecture=MSIL">
<HintPath>..\packages\AutoFixture.AutoMoq.3.50.3\lib\net40\Ploeh.AutoFixture.AutoMoq.dll</HintPath>
<HintPath>..\packages\AutoFixture.AutoMoq.3.50.6\lib\net40\Ploeh.AutoFixture.AutoMoq.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\BicycleTripsPreparationApp\packages\System.Management.Automation.6.1.7601.17515\lib\net45\System.Management.Automation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="theRightDirection.Library.UnitTesting, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down Expand Up @@ -143,6 +157,12 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="pois2.gpx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="pois.gpx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Sample.gpx">
<SubType>Designer</SubType>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
Expand Up @@ -26,7 +26,7 @@ public void Setup()
[TestMethod]
public void OrderBy()
{
Mock<IRoute> mock = new Mock<IRoute>();
Mock<IPath> mock = new Mock<IPath>();
var list = new List<BikeTouringGISLayer>() { new BikeTouringGISLayer("abc", mock.Object), new BikeTouringGISLayer("Points of Interest"), new BikeTouringGISLayer("def", mock.Object) };
var result = list.OrderBy(x => x.Type);
var firstItem = result.First().Type == LayerType.PointsOfInterest;
Expand Down
6 changes: 4 additions & 2 deletions BikeTouringGIS.Library.UnitTests/BikeTouringGISLayerTest.cs
Expand Up @@ -10,6 +10,7 @@
using FluentAssertions;
using BikeTouringGISLibrary.Model;
using GPX;
using BikeTouringGISLibrary.Services;

namespace BikeTouringGISLibrary.UnitTests
{
Expand Down Expand Up @@ -71,8 +72,9 @@ private BikeTouringGISLayer CreateLayer(string fileName)
{
var path = Path.Combine(UnitTestDirectory, fileName);
var gpxInfo = new GpxFileReader().LoadFile(path);
gpxInfo.Tracks.ForEach(x => x.ConvertTrackToRoute());
gpxInfo.CreateGeometries();
gpxInfo.Tracks.ForEach(x => x.IsConvertedToRoute = true);
var factory = new GeometryFactory(gpxInfo);
factory.CreateGeometries();
var layer = new BikeTouringGISLayer("testroute", gpxInfo.Routes.First());
layer.SetExtentToFitWithWaypoints(gpxInfo.WayPointsExtent);
return layer;
Expand Down
70 changes: 45 additions & 25 deletions BikeTouringGIS.Library.UnitTests/GPXFileReaderTest.cs
Expand Up @@ -4,18 +4,38 @@
using System.IO;
using BikeTouringGISLibrary.Model;
using BikeTouringGIS.Controls;
using BikeTouringGISLibrary.Services;

namespace BikeTouringGISLibrary.UnitTests
{
[TestClass]
public class GPXFileReaderTest : UnitTestingBase
{
private GpxFileReader _fileReader;
private GeometryFactory _geometryFactory;

[TestInitialize]
public void Setup()
[TestMethod]
// bug #69
public void LoadFile_All_WayPoints_Do_Have_Description()
{
_fileReader = new GpxFileReader();
var gpxInfo = LoadGPXData("dwingeloo.gpx");
foreach (var wpt in gpxInfo.WayPoints)
{
wpt.Name.Should().NotBeNullOrEmpty(wpt.Points[0].ToString());
}
}

[TestMethod]
// bug #34
public void LoadFile_Check_If_All_Have_Length()
{
var gpxInfo = LoadGPXData("Sample.gpx");
gpxInfo.Tracks.ForEach(x => x.IsConvertedToRoute = true);
_geometryFactory.CreateGeometries();
foreach (var route in gpxInfo.Routes)
{
var layer = new BikeTouringGISLayer("testroute", route);
layer.Extent.Should().NotBeNull($"route, {route.Name}");
}
}

[TestMethod]
Expand All @@ -38,37 +58,37 @@ public void LoadFile_Counts_Tracks_Routes_Waypoints_Are_Correct2()
}

[TestMethod]
// bug #34
public void LoadFile_Check_If_All_Have_Length()
// #100 file gecorrigeerd en geen fouten
public void LoadFile_Counts_Waypoints_Are_Correct()
{
var gpxInfo = LoadGPXData("Sample.gpx");
gpxInfo.Tracks.ForEach(x => x.ConvertTrackToRoute());
gpxInfo.CreateGeometries();
foreach(var route in gpxInfo.Routes)
{
var layer = new BikeTouringGISLayer("testroute", route);
layer.Extent.Should().NotBeNull($"route, {route.Name}");
}
var gpxInfo = LoadGPXData("pois.gpx");
gpxInfo.Routes.Count.ShouldBeEquivalentTo(0);
gpxInfo.Tracks.Count.ShouldBeEquivalentTo(0);
gpxInfo.WayPoints.Count.ShouldBeEquivalentTo(157);
}

[TestMethod]
// bug #69
public void LoadFile_All_WayPoints_Do_Have_Description()
// #100
public void LoadFile_Counts_Waypoints_Are_Correct2()
{
var gpxInfo = LoadGPXData("pois2.gpx");
gpxInfo.Routes.Count.ShouldBeEquivalentTo(0);
gpxInfo.Tracks.Count.ShouldBeEquivalentTo(0);
gpxInfo.WayPoints.Count.ShouldBeEquivalentTo(157);
}

[TestInitialize]
public void Setup()
{
var gpxInfo = LoadGPXData("dwingeloo.gpx");
foreach(var wpt in gpxInfo.WayPoints)
{
wpt.Name.Should().NotBeNullOrEmpty(wpt.Points[0].ToString());
}
}

private GpxInformation LoadGPXData(string fileName)
{
var fileReader = new GpxFileReader();
var path = Path.Combine(UnitTestDirectory, fileName);
var gpxInfo = _fileReader.LoadFile(path);
gpxInfo.CreateGeometries();
var gpxInfo = fileReader.LoadFile(path);
_geometryFactory = new GeometryFactory(gpxInfo);
return gpxInfo;
}

}
}
}
Expand Up @@ -15,6 +15,8 @@
using BikeTouringGISLibrary.Model;
using System.Collections.ObjectModel;
using BikeTouringGIS.Extensions;
using BikeTouringGISLibrary.Services;
using BikeTouringGIS.Services;

namespace BikeTouringGISLibrary.UnitTests.ViewModels
{
Expand Down Expand Up @@ -98,23 +100,18 @@ private List<BikeTouringGISLayer> GetLayers(string path)
{
var gpxData = GetGPXData(path);
_vm.AddPoIs(gpxData.WayPoints);
gpxData.AllRoutes.ForEach(x =>
{
var layer = new BikeTouringGISLayer(path, x);
_vm.AddRoutes(layer);
});
var layerFactory = new LayerFactory(gpxData.WayPointsExtent);
_vm.AddRoutes(layerFactory.CreateRoutes(gpxData.Routes));
_vm.BikeTouringGISLayers = new ObservableCollection<BikeTouringGISLayer>(_vm.Map.GetBikeTouringGISLayers());
return _vm.BikeTouringGISLayers.ToList();
}

private GpxInformation GetGPXData(string fileName)
{
var gpxFileInformation = new GpxFileReader().LoadFile(fileName);
foreach (var track in gpxFileInformation.Tracks)
{
track.ConvertTrackToRoute();
}
gpxFileInformation.CreateGeometries();
gpxFileInformation.Tracks.ForEach(t => t.IsConvertedToRoute = true);
var factory = new GeometryFactory(gpxFileInformation);
factory.CreateGeometries();
return gpxFileInformation;
}

Expand Down
Expand Up @@ -42,9 +42,9 @@ public void OpenGPXFile_Cant_Load_Two_Times_Same_File()
var filename = "85.gpx";
var path = Path.Combine(UnitTestDirectory, filename);
_vm.OpenGpxFile(_map, path);
_map.BikeTouringGISLayers.Count.ShouldBeEquivalentTo(2);
_map.BikeTouringGISLayers.Count.ShouldBeEquivalentTo(1);
_vm.OpenGpxFile(_map, path);
_map.BikeTouringGISLayers.Count.ShouldBeEquivalentTo(2);
_map.BikeTouringGISLayers.Count.ShouldBeEquivalentTo(1);
}


Expand Down
Expand Up @@ -10,19 +10,21 @@
using BikeTouringGIS.Controls;
using BikeTouringGISLibrary.Enumerations;
using Moq;
using BikeTouringGISLibrary.Model;
using Ploeh.AutoFixture;
namespace BikeTouringGISLibrary.UnitTests.ViewModels
{
[TestClass]
public class LayerListViewModelTest : UnitTestingBase
{
private LayerListViewModel _vm;
private IRoute _route;
private IPath _route;

[TestInitialize]
public void Setup()
{
_vm = new LayerListViewModel();
_route = new Mock<IRoute>().Object;
_route = new Mock<IPath>().Object;
}

[TestMethod]
Expand All @@ -42,6 +44,7 @@ public void SelectedLayer_Is_Not_Null_With_SplitRouteLayer()
[TestMethod]
public void SelectedLayer_Is_Not_Null_With_GPXLayer()
{
_route = _fixture.Build<Route>().OmitAutoProperties().Create();
var layer = new BikeTouringGISLayer("test", _route);
_vm.SelectedLayer = layer;
_vm.SelectedLayer.Type.ShouldBeEquivalentTo(LayerType.GPXRoute);
Expand Down
4 changes: 2 additions & 2 deletions BikeTouringGIS.Library.UnitTests/app.config
Expand Up @@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Moq" publicKeyToken="69f491c39445e920" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.7.63.0" newVersion="4.7.63.0" />
<bindingRedirect oldVersion="0.0.0.0-4.7.99.0" newVersion="4.7.99.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Ploeh.AutoFixture" publicKeyToken="b24654c590009d4f" culture="neutral" />
Expand Down Expand Up @@ -32,7 +32,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SharpCompress" publicKeyToken="afb0a02973931d96" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.17.1.0" newVersion="0.17.1.0" />
<bindingRedirect oldVersion="0.0.0.0-0.18.2.0" newVersion="0.18.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
12 changes: 7 additions & 5 deletions BikeTouringGIS.Library.UnitTests/packages.config
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoFixture" version="3.50.3" targetFramework="net462" />
<package id="AutoFixture.AutoMoq" version="3.50.3" targetFramework="net462" />
<package id="Castle.Core" version="4.1.0" targetFramework="net462" />
<package id="FluentAssertions" version="4.19.3" targetFramework="net462" />
<package id="Moq" version="4.7.63" targetFramework="net462" />
<package id="AutoFixture" version="3.50.6" targetFramework="net462" />
<package id="AutoFixture.AutoMoq" version="3.50.6" targetFramework="net462" />
<package id="Castle.Core" version="4.1.1" targetFramework="net462" />
<package id="CommonServiceLocator" version="2.0.2" targetFramework="net462" />
<package id="FluentAssertions" version="4.19.4" targetFramework="net462" />
<package id="Moq" version="4.7.99" targetFramework="net462" />
<package id="MvvmLightLibs" version="5.4.1" targetFramework="net462" />
<package id="System.Management.Automation" version="6.1.7601.17515" targetFramework="net461" />
<package id="theRightDirection.Library.UnitTesting" version="1.0.3" targetFramework="net461" />
</packages>

0 comments on commit c89e03b

Please sign in to comment.