Closed munizig closed 5 years ago
@munizig hey, i fix some AreEquals here, https://github.com/andrebaltieri/flunt/pull/32
@munizig hey, i fix some AreEquals here, #32
Tks Claudio, but for longs it is still the same. But, is it really makes sense to compare opposite of function's name? Function AreEquals
testing if they are different to add notification? I'm understanding when they are Equals, add an error (notification).
public Contract AreEquals(string val, string text, string property, string message, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
{
if (!val.Equals(text, comparisonType))
AddNotification(property, message);
return this;
}
All of other methods are test this way, like
public Contract IsNullOrEmpty(string val, string property, string message)
{
if (!string.IsNullOrEmpty(val))
AddNotification(property, message);
return this;
}
they test the opposite way, i think because if you are test some input of a user and you need a property to be not null you will add a notification if they are null, because if are not null you can continues the flow.
Thanks guys! Merged the PRs with the bug fixed!
Following the course from balta.io and using a code line as follows:
.AreEquals(0, subscription.Payments.Count, "Student.Subscription.Payments", "Esta assinatura não possui pagamentos."));
subscription.Payments.Count
is 1 in this context.So it should add a notification, does not? (I understand they are different, so add a notification). It's not adding one. It only worked when I changed the condition to
.AreNotEquals
.