-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/core-refactoring
- Loading branch information
Showing
21 changed files
with
9,344 additions
and
8,709 deletions.
There are no files selected for viewing
17,070 changes: 8,441 additions & 8,629 deletions
17,070
src/SampleApps/SampleApp.Angular/ClientApp/package-lock.json
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
...mplify.Web.Tests/Model/Validation/Attributes/MaxAttributeTests/DoubleMaxAttributeTests.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,54 @@ | ||
using NUnit.Framework; | ||
using Simplify.Web.Model.Validation.Attributes; | ||
using System; | ||
|
||
namespace Simplify.Web.Tests.Model.Validation.Attributes.MaxAttributeTests; | ||
|
||
[TestFixture] | ||
public class DoubleMaxAttributeTests : AttributesTestBase | ||
{ | ||
public const double MaxValue = 12d; | ||
|
||
[OneTimeSetUp] | ||
public void SetupAttribute() => Attr = new MaxAttribute(MaxValue); | ||
|
||
[Test] | ||
public void Validate_BelowMaxValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue(10d); | ||
} | ||
|
||
[Test] | ||
public void Validate_MaxValueEqualsValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue(12d); | ||
} | ||
|
||
[Test] | ||
public void Validate_AboveMaxValue_ExceptionThrown() | ||
{ | ||
// Assign | ||
|
||
var value = 15d; | ||
var defaultMessage = $"Property '{nameof(TestEntityWithProperty.Prop1)}' required maximum value is {MaxValue}, actual value: {value}"; | ||
|
||
// Act & Assert | ||
TestAttribute(value, defaultMessage); | ||
} | ||
|
||
[Test] | ||
public void Validate_NullValue_NoExceptions() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue(null); | ||
} | ||
|
||
[Test] | ||
public void Validate_DifferentTypes_ExceptionThrown() | ||
{ | ||
// Act & Assert | ||
Assert.Throws<ArgumentException>(() => TestAttributeForValidValue((long)15.2)); | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
...Simplify.Web.Tests/Model/Validation/Attributes/MaxAttributeTests/LongMaxAttributeTests.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,53 @@ | ||
using NUnit.Framework; | ||
using Simplify.Web.Model.Validation.Attributes; | ||
using System; | ||
|
||
namespace Simplify.Web.Tests.Model.Validation.Attributes.MaxAttributeTests; | ||
|
||
public class LongMaxAttributeTests : AttributesTestBase | ||
{ | ||
public const long MaxValue = 12; | ||
|
||
[OneTimeSetUp] | ||
public void SetupAttribute() => Attr = new MaxAttribute(MaxValue); | ||
|
||
[Test] | ||
public void Validate_BelowMaxValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue((long)10); | ||
} | ||
|
||
[Test] | ||
public void Validate_MaxValueEqualsValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue((long)12); | ||
} | ||
|
||
[Test] | ||
public void Validate_AboveMaxValue_ExceptionThrown() | ||
{ | ||
// Assign | ||
|
||
var value = (long)15; | ||
var defaultMessage = $"Property '{nameof(TestEntityWithProperty.Prop1)}' required maximum value is {MaxValue}, actual value: {value}"; | ||
|
||
// Act & Assert | ||
TestAttribute(value, defaultMessage); | ||
} | ||
|
||
[Test] | ||
public void Validate_NullValue_NoExceptions() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue(null); | ||
} | ||
|
||
[Test] | ||
public void Validate_DifferentTypes_ExceptionThrown() | ||
{ | ||
// Act & Assert | ||
Assert.Throws<ArgumentException>(() => TestAttributeForValidValue(15.2d)); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...lify.Web.Tests/Model/Validation/Attributes/MaxAttributeTests/MaxAttributeTestViewModel.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,18 @@ | ||
using Simplify.Web.Model.Validation.Attributes; | ||
|
||
namespace Simplify.Web.Tests.Model.Validation.Attributes.MaxAttributeTests; | ||
|
||
public class MaxAttributeTestViewModel | ||
{ | ||
[Max(1)] | ||
public int IntParam { get; set; } | ||
|
||
[Max((long)1)] | ||
public long LongParam { get; set; } | ||
|
||
[Max(1d)] | ||
public double DoubleParam { get; set; } | ||
|
||
[Max(typeof(decimal), "12.5")] | ||
public decimal DecimalParam { get; set; } | ||
} |
60 changes: 60 additions & 0 deletions
60
...Simplify.Web.Tests/Model/Validation/Attributes/MaxAttributeTests/TypeMaxAttributeTests.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,60 @@ | ||
using NUnit.Framework; | ||
using Simplify.Web.Model.Validation.Attributes; | ||
using System; | ||
|
||
namespace Simplify.Web.Tests.Model.Validation.Attributes.MaxAttributeTests; | ||
|
||
public class TypeMaxAttributeTests : AttributesTestBase | ||
{ | ||
public const string MaxValue = "12.5"; | ||
|
||
[OneTimeSetUp] | ||
public void SetupAttribute() => Attr = new MaxAttribute(typeof(decimal), MaxValue); | ||
|
||
[Test] | ||
public void Validate_BelowMaxValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue((decimal)10); | ||
} | ||
|
||
[Test] | ||
public void Validate_MaxValueEqualsValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue((decimal)12.5); | ||
} | ||
|
||
[Test] | ||
public void Validate_AboveMaxValue_ExceptionThrown() | ||
{ | ||
// Assign | ||
|
||
var value = (decimal)15; | ||
var defaultMessage = $"Property '{nameof(TestEntityWithProperty.Prop1)}' required maximum value is {MaxValue}, actual value: {value}"; | ||
|
||
// Act & Assert | ||
TestAttribute(value, defaultMessage); | ||
} | ||
|
||
[Test] | ||
public void Validate_NullValue_NoExceptions() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue(null); | ||
} | ||
|
||
[Test] | ||
public void Validate_DifferentTypes_ExceptionThrown() | ||
{ | ||
// Act & Assert | ||
Assert.Throws<ArgumentException>(() => TestAttributeForValidValue(15.2d)); | ||
} | ||
|
||
[Test] | ||
public void Validate_ObjectValueIsNotIComparable_ExceptionThrown() | ||
{ | ||
// Act & Assert | ||
Assert.Throws<ArgumentException>(() => TestAttributeForValidValue(new object())); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...mplify.Web.Tests/Model/Validation/Attributes/MinAttributeTests/DoubleMinAttributeTests.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,53 @@ | ||
using NUnit.Framework; | ||
using Simplify.Web.Model.Validation.Attributes; | ||
using System; | ||
|
||
namespace Simplify.Web.Tests.Model.Validation.Attributes.MinAttributeTests; | ||
|
||
public class DoubleMinAttributeTests : AttributesTestBase | ||
{ | ||
public const double MinValue = 12d; | ||
|
||
[OneTimeSetUp] | ||
public void SetupAttribute() => Attr = new MinAttribute(MinValue); | ||
|
||
[Test] | ||
public void Validate_AboveMinValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue(15d); | ||
} | ||
|
||
[Test] | ||
public void Validate_MinValueEqualsValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue(12d); | ||
} | ||
|
||
[Test] | ||
public void Validate_BelowMinValue_ExceptionThrown() | ||
{ | ||
// Assign | ||
|
||
var value = 8d; | ||
var defaultMessage = $"Property '{nameof(TestEntityWithProperty.Prop1)}' required minimum value is {MinValue}, actual value: {value}"; | ||
|
||
// Act & Assert | ||
TestAttribute(value, defaultMessage); | ||
} | ||
|
||
[Test] | ||
public void Validate_NullValue_NoExceptions() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue(null); | ||
} | ||
|
||
[Test] | ||
public void Validate_DifferentTypes_ExceptionThrown() | ||
{ | ||
// Act & Assert | ||
Assert.Throws<ArgumentException>(() => TestAttributeForValidValue((long)12)); | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
...Simplify.Web.Tests/Model/Validation/Attributes/MinAttributeTests/LongMinAttributeTests.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,53 @@ | ||
using NUnit.Framework; | ||
using Simplify.Web.Model.Validation.Attributes; | ||
using System; | ||
|
||
namespace Simplify.Web.Tests.Model.Validation.Attributes.MinAttributeTests; | ||
|
||
public class LongMinAttributeTests : AttributesTestBase | ||
{ | ||
public const long MinValue = 12; | ||
|
||
[OneTimeSetUp] | ||
public void SetupAttribute() => Attr = new MinAttribute(MinValue); | ||
|
||
[Test] | ||
public void Validate_AboveMinValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue((long)15); | ||
} | ||
|
||
[Test] | ||
public void Validate_MinValueEqualsValue_Ok() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue((long)12); | ||
} | ||
|
||
[Test] | ||
public void Validate_BelowMinValue_ExceptionThrown() | ||
{ | ||
// Assign | ||
|
||
var value = (long)8; | ||
var defaultMessage = $"Property '{nameof(TestEntityWithProperty.Prop1)}' required minimum value is {MinValue}, actual value: {value}"; | ||
|
||
// Act & Assert | ||
TestAttribute(value, defaultMessage); | ||
} | ||
|
||
[Test] | ||
public void Validate_NullValue_NoExceptions() | ||
{ | ||
// Act & Assert | ||
TestAttributeForValidValue(null); | ||
} | ||
|
||
[Test] | ||
public void Validate_DifferentTypes_ExceptionThrown() | ||
{ | ||
// Act & Assert | ||
Assert.Throws<ArgumentException>(() => TestAttributeForValidValue(12)); | ||
} | ||
} |
Oops, something went wrong.