C# Class SWFProcessing.Swiffotron.Processor.SwiffotronContext

The context within which the current swiffotron job is running, so that we can create better log information.
Afficher le fichier Open project: WeeWorld/Swiffotron Class Usage Examples

Méthodes publiques

Méthode Description
Sentinel ( string sentinelLabel ) : SwiffotronContext

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

Method Details

Sentinel() public méthode

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
public Sentinel ( string sentinelLabel ) : SwiffotronContext
sentinelLabel string An arbitrary string.
Résultat SwiffotronContext

SwiffotronContext() public méthode

public SwiffotronContext ( string name )
name string

ToString() public méthode

public ToString ( ) : string
Résultat string