-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from GhostwareDev/development
New release
- Loading branch information
Showing
14 changed files
with
209 additions
and
145 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
GPS.NET/Ghostware.GPS.NET.UnitTests/Factories/GpsClientFactoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using System; | ||
using Ghostware.GPS.NET.Enums; | ||
using Ghostware.GPS.NET.Exceptions; | ||
using Ghostware.GPS.NET.Factories; | ||
using Ghostware.GPS.NET.GpsClients; | ||
using Ghostware.GPS.NET.Models.ConnectionInfo; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Ghostware.GPS.NET.UnitTests.Factories | ||
{ | ||
[TestClass] | ||
public class GpsClientFactoryTests | ||
{ | ||
#region Create by GpsType Tests | ||
|
||
[TestMethod] | ||
public void CreateComPortGpsTypeTest() | ||
{ | ||
var result = GpsClientFactory.Create(GpsType.ComPort); | ||
Assert.IsInstanceOfType(result, typeof(ComPortGpsClient)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateGpsdGpsTypeTest() | ||
{ | ||
var result = GpsClientFactory.Create(GpsType.Gpsd); | ||
Assert.IsInstanceOfType(result, typeof(GpsdGpsClient)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateFileGpsTypeTest() | ||
{ | ||
var result = GpsClientFactory.Create(GpsType.File); | ||
Assert.IsInstanceOfType(result, typeof(FileGpsClient)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateWindowsLocationApiGpsTypeTest() | ||
{ | ||
var result = GpsClientFactory.Create(GpsType.WindowsLocationApi); | ||
Assert.IsInstanceOfType(result, typeof(WindowsLocationApiGpsClient)); | ||
} | ||
|
||
#endregion | ||
|
||
#region Create by GpsInfo Tests | ||
|
||
[TestMethod] | ||
public void CreateComPortGpsInfoTest() | ||
{ | ||
var result = GpsClientFactory.Create(new ComPortInfo()); | ||
Assert.IsInstanceOfType(result, typeof(ComPortGpsClient)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateGpsdGpsInfoTest() | ||
{ | ||
var result = GpsClientFactory.Create(new GpsdInfo()); | ||
Assert.IsInstanceOfType(result, typeof(GpsdGpsClient)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateFileGpsInfoTest() | ||
{ | ||
var result = GpsClientFactory.Create(new FileGpsInfo()); | ||
Assert.IsInstanceOfType(result, typeof(FileGpsClient)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateWindowsLocationApiGpsInfoTest() | ||
{ | ||
var result = GpsClientFactory.Create(new WindowsLocationApiInfo()); | ||
Assert.IsInstanceOfType(result, typeof(WindowsLocationApiGpsClient)); | ||
} | ||
|
||
[TestMethod] | ||
[ExpectedException(typeof(UnknownTypeException))] | ||
public void CreateUnkownGpsInfoTest() | ||
{ | ||
GpsClientFactory.Create(new UnkownGpsInfo()); | ||
} | ||
|
||
#endregion | ||
|
||
[TestMethod] | ||
[ExpectedException(typeof(NullReferenceException))] | ||
public void CreateNullGpsTest() | ||
{ | ||
GpsClientFactory.Create(null); | ||
} | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
GPS.NET/Ghostware.GPS.NET.UnitTests/Factories/GpsDataFactoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using Ghostware.GPS.NET.Enums; | ||
using Ghostware.GPS.NET.Factories; | ||
using Ghostware.GPS.NET.Models.ConnectionInfo; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Ghostware.GPS.NET.UnitTests.Factories | ||
{ | ||
[TestClass] | ||
public class GpsDataFactoryTests | ||
{ | ||
#region Create GpsInfo Tests | ||
|
||
[TestMethod] | ||
public void CreateComPortGpsInfoTest() | ||
{ | ||
var result = GpsDataFactory.Create(GpsType.ComPort); | ||
Assert.IsInstanceOfType(result, typeof(ComPortInfo)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateGpsdGpsInfoTest() | ||
{ | ||
var result = GpsDataFactory.Create(GpsType.Gpsd); | ||
Assert.IsInstanceOfType(result, typeof(GpsdInfo)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateFileGpsInfoTest() | ||
{ | ||
var result = GpsDataFactory.Create(GpsType.File); | ||
Assert.IsInstanceOfType(result, typeof(FileGpsInfo)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateWindowsLocationApiGpsInfoTest() | ||
{ | ||
var result = GpsDataFactory.Create(GpsType.WindowsLocationApi); | ||
Assert.IsInstanceOfType(result, typeof(WindowsLocationApiInfo)); | ||
} | ||
|
||
#endregion | ||
|
||
#region GetDataType Tests | ||
|
||
[TestMethod] | ||
public void CreateComPortGpsInfoTypeTest() | ||
{ | ||
var result = GpsDataFactory.GetDataType(GpsType.ComPort); | ||
Assert.AreEqual(result, typeof(ComPortInfo)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateGpsdGpsInfoTypeTest() | ||
{ | ||
var result = GpsDataFactory.GetDataType(GpsType.Gpsd); | ||
Assert.AreEqual(result, typeof(GpsdInfo)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateFileGpsInfoTypeTest() | ||
{ | ||
var result = GpsDataFactory.GetDataType(GpsType.File); | ||
Assert.AreEqual(result, typeof(FileGpsInfo)); | ||
} | ||
|
||
[TestMethod] | ||
public void CreateWindowsLocationApiGpsInfoTypeTest() | ||
{ | ||
var result = GpsDataFactory.GetDataType(GpsType.WindowsLocationApi); | ||
Assert.AreEqual(result, typeof(WindowsLocationApiInfo)); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
GPS.NET/Ghostware.GPS.NET.UnitTests/Factories/UnkownGpsInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Ghostware.GPS.NET.Models.ConnectionInfo; | ||
|
||
namespace Ghostware.GPS.NET.UnitTests.Factories | ||
{ | ||
public class UnkownGpsInfo : BaseGpsInfo | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.