-
-
Notifications
You must be signed in to change notification settings - Fork 535
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 #443 from RSuter/master
Release v9.4.4
- Loading branch information
Showing
11 changed files
with
119 additions
and
7 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Linq; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Newtonsoft.Json.Linq; | ||
using NJsonSchema.Validation; | ||
|
||
namespace NJsonSchema.Tests.Validation | ||
{ | ||
[TestClass] | ||
public class FormatTimeSpanTests | ||
{ | ||
[TestMethod] | ||
public void When_format_time_span_incorrect_then_validation_fails() | ||
{ | ||
//// Arrange | ||
var schema = new JsonSchema4(); | ||
schema.Type = JsonObjectType.String; | ||
schema.Format = JsonFormatStrings.TimeSpan; | ||
|
||
var token = new JValue("test"); | ||
|
||
//// Act | ||
var errors = schema.Validate(token); | ||
|
||
//// Assert | ||
Assert.AreEqual(ValidationErrorKind.TimeSpanExpected, errors.First().Kind); | ||
} | ||
|
||
[TestMethod] | ||
public void When_format_time_span_correct_then_validation_succeeds() | ||
{ | ||
//// Arrange | ||
var schema = new JsonSchema4(); | ||
schema.Type = JsonObjectType.String; | ||
schema.Format = JsonFormatStrings.TimeSpan; | ||
|
||
var token = new JValue("1:30:45"); | ||
|
||
//// Act | ||
var errors = schema.Validate(token); | ||
|
||
//// Assert | ||
Assert.AreEqual(0, errors.Count()); | ||
} | ||
} | ||
} |
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