-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into TM-15-Transfer-Allowance
- Loading branch information
Showing
24 changed files
with
510 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -274,3 +274,6 @@ App.Debug.config | |
|
||
# Local configs | ||
src/**/appsettings.Development.json | ||
|
||
#nservicebus | ||
*.learningtransport* |
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
45 changes: 45 additions & 0 deletions
45
src/SFA.DAS.ApprenticeCommitments.Api.AcceptanceTests/JsonConvertExtensions.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,45 @@ | ||
using FluentAssertions; | ||
using FluentAssertions.Execution; | ||
using FluentAssertions.Primitives; | ||
using Newtonsoft.Json; | ||
|
||
namespace SFA.DAS.ApprenticeCommitments.Api.AcceptanceTests | ||
{ | ||
public static class JsonConvertExtensions | ||
{ | ||
public static AndWhichConstraint<JsonConvertAssertions, T> ShouldBeJson<T>(this string instance) | ||
{ | ||
return new JsonConvertAssertions(instance).DeserialiseTo<T>(); | ||
} | ||
|
||
public static AndWhichConstraint<JsonConvertAssertions, T> ShouldBeJson<T>(this StringAssertions instance) | ||
{ | ||
return new JsonConvertAssertions(instance.Subject).DeserialiseTo<T>(); | ||
} | ||
|
||
public class JsonConvertAssertions : | ||
ReferenceTypeAssertions<string, JsonConvertAssertions> | ||
{ | ||
public JsonConvertAssertions(string instance) | ||
{ | ||
Subject = instance; | ||
} | ||
|
||
protected override string Identifier => "string"; | ||
|
||
public AndWhichConstraint<JsonConvertAssertions, T> DeserialiseTo<T>( | ||
string because = "", params object[] becauseArgs) | ||
{ | ||
var deserialised = JsonConvert.DeserializeObject<T>(Subject); | ||
|
||
Execute.Assertion | ||
.ForCondition(deserialised != null) | ||
.BecauseOf(because, becauseArgs) | ||
.FailWith("Expected {context:string} to contain deserilise to {0}{reason}, but found.", | ||
typeof(T).Name); | ||
|
||
return new AndWhichConstraint<JsonConvertAssertions, T>(this, deserialised); | ||
} | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.