- public static class myValidationExt
- {
- public static IRuleBuilderOptions
onlyPositive this IRuleBuilder( ruleBuilder) - where TProperty : struct, IComparable
, IComparable - {
- return ruleBuilder.GreaterThan(default(TProperty)).WithMessage("StudentId should only be greater than zero");
- }
- }
- [Test]
- [ExpectedException(typeof(Exception), ExpectedMessage = "StudentId should only be greater than zero")]
- public void Positive_Valuelessthanzero_ValidationPassed()
- {
- //Arrange
- Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us");
- //Act
- var myString = myValidationExt.onlyPositive(*******); // How to pass the parameter???
- //Assert
- }

Tapan PatelRank #614 · 3.9K reputationPosted Oct 10, 2017, 5:25 AM EDT