You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following report: "Partially covered (4 visits, 1 of 2 branches are covered)" for the line: return from < to; and I cannot figure out why I don't get full coverage?
I have a very simple method:
public static bool IsValidFromTo(DateTimeOffset? from, DateTimeOffset? to)
{
if (from.HasValue && to.HasValue)
{
return from < to;
}
return true;
}
I have written the following test:
1. Both from and to are null.
2. from is null and to is not null.
3. from is not null and to is null.
4. Both from and to are not null, and from is less than to.
5. Both from and to are not null, and from is greater than to.
6. Both from and to are not null, and from is equal to to.
7. Both from and to are not null, and from is equal to to, but they are different instances of DateTimeOffset.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!
I get the following report: "Partially covered (4 visits, 1 of 2 branches are covered)" for the line:
return from < to;
and I cannot figure out why I don't get full coverage?I have a very simple method:
I have written the following test:
I get full coverage for the rest of the method.
Beta Was this translation helpful? Give feedback.
All reactions