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);
- }

Jignesh KumarRank #91 · 22.9K reputationPosted Sep 10, 2020, 7:08 PM EDT
Tangara GRank #4,983 · 316 reputationPosted Sep 10, 2020, 10:18 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Sep 10, 2020, 10:42 PM EDT
Tangara GRank #4,983 · 316 reputationPosted Sep 10, 2020, 11:45 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Sep 11, 2020, 12:09 AM EDT
Tangara GRank #4,983 · 316 reputationPosted Sep 11, 2020, 1:03 AM EDT