TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tangara G
NA
298
93.5k
Why this unit test failed etc?
Sep 10 2020 10:16 PM
I have this method :
private
bool
MatchedTarget(
string
TargetName, Paragraph paragraph,
string
text)
{
bool
targetFound =
false
;
if
(IsHeader(paragraph)) {
text.ToLower().Trim().Contains(TargetName.ToLower().Trim());
targetFound =
true
;
}
return
targetFound;
}
And I have a unit test but it returned me Failed where it is supposed to return Passed.
Please let me know where I had gone wrong
[Test]
public
void
LowerCaseShouldReturnTrue()
{
ProcessingDocx processor =
new
ProcessingDocx(
null
);
Paragraph para = CreateParagraphStyle(
"Normal"
);
System.Type type =
typeof
(ProcessingDocx);
bool
result = (
bool
)type.GetMethod(
"MatchedTarget"
, BindingFlags.NonPublic | BindingFlags.Instance)
.Invoke(processor,
new
object
[] {
"Annex A"
, para,
"annex a"
});
Assert.True(result);
}
Reply
Answers (
6
)
Regular expression validation start two fixed character
Existing c# code to javascript or other web app