I have a class that inherits from the SemanticType class in the Semantic Type project:
I am trying to test my class and ensure that I have a guard clause preventing Null and empty strings from being passed. However, the test fails because the inherited class, SemanticType, does not have a Guard clause. How do I coax AutoFixture to only look at the constructor in my ZipCode class?
public class ZipCode : SemanticType<string>
{
public ZipCode(string value) : base(IsValid, value)
{
Guard.NotNullOrEmpty(() => value, value);
Guard.IsValid(() => value, value, IsValid, "Invalid Zip Code");
}
}
When debugging, the test is failing in SemanticTypes.dll with this message:
An exception of type 'System.ArgumentException' occurred in SemanticTypes.dll but was not handled in user code
In other words, there's no Guard clause in the constructor in SemanticType. Any help you can provide would be most appreciated.
Aucun commentaire:
Enregistrer un commentaire