Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Commit

Permalink
fixes some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OnkelMato committed Feb 27, 2019
1 parent 40f7c5a commit 4f35944
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
2 changes: 2 additions & 0 deletions NZazu.Contracts/CheckFactory_Should.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public void Print_Supported_Types()
{
Console.WriteLine($"factory '{typeof(CheckFactory).Name}' supports type:\t{type}");
}

Assert.Pass();
}

[Test]
Expand Down
44 changes: 28 additions & 16 deletions NZazuFiddle/Samples/ValidationSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ValidationSample() : base(30)
Type = "string",
Prompt = "Name",
Hint = "Enter name",
Description = "Your account name. At least 6 characters (Required)...",
Description = "Validation: required field (required) and at least 6 characters (length)",
Checks = new []
{
new CheckDefinition { Type = "required" },
Expand All @@ -38,10 +38,9 @@ public ValidationSample() : base(30)
Type = "string",
Prompt = "Email",
Hint = "Enter valid e-mail address",
Description = "Your e-mail address",
Description = "Validation: regular expression (regex) [^.+@.+\\..+$]",
Checks = new []
{
new CheckDefinition { Type = "required" },
new CheckDefinition
{
Type = "regex",
Expand All @@ -53,9 +52,8 @@ public ValidationSample() : base(30)
{
Key = "isAdmin",
Type = "bool",
//Prompt = "Is Admin",
Hint = "Is Admin",
Description = "Check to grant administrator permissions",
Description = "Validation: regular expression (regex) [True|False]",
Checks = new []
{
new CheckDefinition { Type = "required" },
Expand All @@ -64,24 +62,37 @@ public ValidationSample() : base(30)
Type = "regex",
Settings = new Dictionary<string ,string>{{"Hint", "Must be Checked or Unchecked" },{"RegEx", "True|False" } }
}
},
Settings = new Dictionary<string, string>()
{
{ "IsThreeState", "True" }
}
},
new FieldDefinition
{
Key = "birthday",
Type = "date",
Prompt = "Birthday",
Hint = "type your birthday",
Key = "int",
Type = "int",
Prompt = "int",
Hint = "Enter a number",
Description = "Validation: Value must be between 10 and 100 (range)",
Checks = new []
{
new CheckDefinition { Type = "required" }
new CheckDefinition
{
Type = "range",
Settings = new Dictionary<string, string>
{
{"Min","10"},
{"Max","100"},
}
}
}
},
new FieldDefinition
{
Key = "startTime",
Type = "string",
Prompt = "Star time",
Prompt = "Start time",
Hint = "Set start time"
},
new FieldDefinition
Expand All @@ -94,7 +105,7 @@ public ValidationSample() : base(30)
{
new CheckDefinition
{
Type = "dateTime",
Type = "datetime",
Settings = new Dictionary<string, string>
{
{"Hint", "End time must lie in future compared to start time" },
Expand All @@ -117,11 +128,12 @@ public ValidationSample() : base(30)
Type = "string",
Prompt = "Another end time",
Hint = "Set end time with specific format to compare with another start time format",
Description = "Validation: Value must be between 10 and 100 (range)",
Checks = new []
{
new CheckDefinition
{
Type = "dateTime",
Type = "datetime",
Settings = new Dictionary<string, string>
{
{"Hint", "End time must lie in future compared to start time" },
Expand All @@ -135,7 +147,7 @@ public ValidationSample() : base(30)
new FieldDefinition
{
Type = "datatable",
Key = "intraTableComparison",
Key = "interTableComparison",
Fields = new []
{
new FieldDefinition
Expand All @@ -153,13 +165,13 @@ public ValidationSample() : base(30)
{
new CheckDefinition
{
Type = "dateTime",
Type = "datetime",
Settings = new Dictionary<string, string>
{
{"Hint", "End time must lie in future compared to start time" },
{"CompareOperator",">"},
{"FieldToCompareWith","startTime"},
{"TableToCompareWith","intraTableComparison"},
{"TableToCompareWith","interTableComparison"},
{"SpecificDateTimeFormats", "HHmm|HHmmss|HH:mm|HH:mm:ss" }
}
}
Expand Down

0 comments on commit 4f35944

Please sign in to comment.