Skip to content

Commit

Permalink
Cleanup & update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1face committed Apr 12, 2019
1 parent eb56657 commit 1a171ae
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions NPPESAPI.net/NPPESAPI.net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<AssemblyVersion>1.1.1.0</AssemblyVersion>
<FileVersion>1.1.1.0</FileVersion>
<Version>1.1.1</Version>
<PackageReleaseNotes>Support for NPPES API v2.1 and newer url versioning scheme</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup Condition="$(TargetFramework) == 'net45' or $(TargetFramework) == 'net451'">
Expand Down
2 changes: 1 addition & 1 deletion NPPESAPI.net/NPPESRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public NPPESRequestBuilder FirstName(string firstName)
/// <summary>
/// Appends or updates the useFirstNameAlias search parameter for the request.
/// </summary>
/// <param name="useFristNameAlieas"></param>
/// <param name="useFirstNameAlias"></param>
/// <returns></returns>
public NPPESRequestBuilder UseFirstNameAlias(bool useFirstNameAlias)
{
Expand Down
5 changes: 2 additions & 3 deletions NPPESAPITest/NPPESApiClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System;
using Forcura.NPPES;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Net;
using System.Threading.Tasks;
using Forcura.NPPES;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace NPPESAPITest
{
Expand Down
24 changes: 24 additions & 0 deletions NPPESAPITest/NPPESRequestBuilderTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Forcura.NPPES;
using Forcura.NPPES.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;

namespace NPPESAPITest
{
Expand All @@ -24,5 +27,26 @@ public void NPPESRequestBuilder_UpdatesValue()
Assert.IsNotNull(request);
Assert.AreEqual(lastNumber, request.Number);
}

[TestMethod]
public void NPPESRequestBuilder_NoVersionUsesLatest()
{
var builder = new NPPESRequestBuilder();

var request = builder.Build();
var maxVersion = Enum.GetValues(typeof(NPPESVersion)).Cast<NPPESVersion>().Last();

Assert.AreEqual(maxVersion, request.Version);
}

[TestMethod]
public void NPPESRequestBuilder_VersionProvidedUsesSpecified()
{
var request = new NPPESRequestBuilder()
.Version(NPPESVersion.v1_0)
.Build();

Assert.AreEqual(NPPESVersion.v1_0, request.Version);
}
}
}

0 comments on commit 1a171ae

Please sign in to comment.