Method | Description | |
---|---|---|
Sentinel ( string sentinelLabel ) : |
When an exception is thrown, we can pass a sentinel string into the context. This is a secret internal string that somehow marks the point that the code has reached. This can be picked up in unit tests to determine that not only was the right type of exception was thrown, but that it was thrown for the right reason. Secret sentinel strings have the advantages of being easy to make up on the spot and immunity to internationalisation, which makes them better than methods that compare error messages, which can change on a whim. To mark a moment in the code, access the context object via this method like this: myContext.Sentinel("My meaningful string"); // returns myContext
|
|
SwiffotronContext ( string name ) | ||
ToString ( ) : string |
public Sentinel ( string sentinelLabel ) : |
||
sentinelLabel | string | An arbitrary string. |
return |