Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
unit test for the following code
darma teja
Oct 10 2017 2:36 AM
135
Reply
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
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How to change button color of form1 by clicking form2 button
How to find translate point for zoomed -in view