forked from pact-foundation/pact-net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding some more tests for mappers and refactoring to support multipl…
…e content types
- Loading branch information
1 parent
7dea75c
commit 3852d14
Showing
17 changed files
with
607 additions
and
123 deletions.
There are no files selected for viewing
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 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
83 changes: 83 additions & 0 deletions
83
PactNet.Tests/Mocks/MockHttpService/Mappers/HttpVerbMapperTests.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,83 @@ | ||
using System; | ||
using PactNet.Mocks.MockHttpService.Mappers; | ||
using PactNet.Mocks.MockHttpService.Models; | ||
using Xunit; | ||
|
||
namespace PactNet.Tests.Mocks.MockHttpService.Mappers | ||
{ | ||
public class HttpVerbMapperTests | ||
{ | ||
private IHttpVerbMapper GetSubject() | ||
{ | ||
return new HttpVerbMapper(); | ||
} | ||
|
||
[Fact] | ||
public void Convert_WithValueThatDoesNotHaveAMap_ThrowsArgumentException() | ||
{ | ||
var mapper = GetSubject(); | ||
|
||
Assert.Throws<ArgumentException>(() => mapper.Convert("blah")); | ||
} | ||
|
||
[Fact] | ||
public void Convert_WithGetString_ReturnsHttpVerbGet() | ||
{ | ||
var mapper = GetSubject(); | ||
|
||
var result = mapper.Convert("GET"); | ||
|
||
Assert.Equal(HttpVerb.Get, result); | ||
} | ||
|
||
[Fact] | ||
public void Convert_WithPostString_ReturnsHttpVerbPost() | ||
{ | ||
var mapper = GetSubject(); | ||
|
||
var result = mapper.Convert("POST"); | ||
|
||
Assert.Equal(HttpVerb.Post, result); | ||
} | ||
|
||
[Fact] | ||
public void Convert_WithPutString_ReturnsHttpVerbPut() | ||
{ | ||
var mapper = GetSubject(); | ||
|
||
var result = mapper.Convert("PUT"); | ||
|
||
Assert.Equal(HttpVerb.Put, result); | ||
} | ||
|
||
[Fact] | ||
public void Convert_WithDeleteString_ReturnsHttpVerbDelete() | ||
{ | ||
var mapper = GetSubject(); | ||
|
||
var result = mapper.Convert("DELETE"); | ||
|
||
Assert.Equal(HttpVerb.Delete, result); | ||
} | ||
|
||
[Fact] | ||
public void Convert_WithHeadString_ReturnsHttpVerbHead() | ||
{ | ||
var mapper = GetSubject(); | ||
|
||
var result = mapper.Convert("HEAD"); | ||
|
||
Assert.Equal(HttpVerb.Head, result); | ||
} | ||
|
||
[Fact] | ||
public void Convert_WithPatchString_ReturnsHttpVerbPatch() | ||
{ | ||
var mapper = GetSubject(); | ||
|
||
var result = mapper.Convert("PATCH"); | ||
|
||
Assert.Equal(HttpVerb.Patch, result); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.