TestExecutionContext Class

Summary

An Wyam.Common.Execution.IExecutionContext that can be used for testing.
Assembly
Wyam.Testing.dll
Namespace
Wyam.Testing.Execution
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IExecutionContext"] click Interface0 "/api/Wyam.Common.Execution/IExecutionContext" Type-.->Interface1["IMetadata"] click Interface1 "/api/Wyam.Common.Meta/IMetadata" Type-.->Interface2["IReadOnlyDictionary<string, Object>"] Type-.->Interface3["ITypeConversions"] click Interface3 "/api/Wyam.Testing.Meta/ITypeConversions" Type["TestExecutionContext"] class Type type-node

Syntax

public class TestExecutionContext : IExecutionContext, IMetadata, 
    IReadOnlyDictionary<string, Object>, ITypeConversions

Properties

Name Value Summary
ApplicationInput string
Gets any input that was passed to the application (for example, on stdin via piping).
Count int
Documents IDocumentCollection
Gets the collection of all previously processed documents.
DynamicAssemblies IReadOnlyCollection<byte[]>
Gets the raw bytes for dynamically compiled assemblies (such as the configuration script).
ExecutionCache IExecutionCache
Gets the current execution cache. Modules can use the cache to store data between executions.
ExecutionId Guid
Uniquly identifies the current execution cycle. This can be used to initialize and/or reset static data for a module on new generations (I.e., due to watching). For example, cache data could be cleared when this changes between runs.
FileSystem IReadOnlyFileSystem
Gets the current file system.
HttpResponseFunc Func<HttpRequestMessage, HttpMessageHandler, HttpResponseMessage>
A message handler that should be used to register System.Net.Http.HttpResponseMessage instances for a given request.
JsEngineFunc Func<IJavaScriptEngine>
Keys IEnumerable<string>
Module IModule
Gets the currently executing module.
Namespaces IReadOnlyCollection<string>
Gets a set of namespaces that should be brought into scope for modules that perform dynamic compilation.
Pipeline IReadOnlyPipeline
Gets the currently executing pipeline.
Settings ISettings
Shortcodes IShortcodeCollection
this[string] Object
TypeConversions Dictionary<(Type Value, Type Result), Func<Object, Object>>
Values IEnumerable<Object>

Methods

Name Value Summary
AddTypeConversion<T, TResult>(Func<T, TResult>) void
ContainsKey(string) bool
CreateHttpClient() HttpClient
Creates a System.Net.Http.HttpClient instance that should be used for all HTTP communication.
CreateHttpClient(HttpMessageHandler) HttpClient
Creates a new System.Net.Http.HttpClient instance that uses a custom message handler.
Execute(IEnumerable<IModule>, IEnumerable<IDocument>) IReadOnlyList<IDocument>
Executes the specified modules with the specified input documents and returns the result documents.
Execute(IEnumerable<IModule>, IEnumerable<KeyValuePair<string, Object>>) IReadOnlyList<IDocument>
Executes the specified modules with an empty initial input document with optional additional metadata and returns the result documents.
Execute(IEnumerable<IModule>, IEnumerable<MetadataItem>) IReadOnlyList<IDocument>
Executes the specified modules with an empty initial input document with optional additional metadata and returns the result documents.
Get(string, Object) Object
Gets the value for the specified key. This method never throws an exception. It will return the specified default value or null if the key is not found.
Get<T>(string) T
Gets the value for the specified key converted to the specified type. This method never throws an exception. It will return default(T) if the key is not found or the value cannot be converted to T.
Get<T>(string, T) T
Gets the value for the specified key. This method never throws an exception. It will return the specified default value if the key is not found.
GetContentStream(string) Stream
Gets a System.IO.Stream that can be used for document content. If content is not null, the stream is initialized with the specified content. It is prefered to use this method to obtain a stream over creating your own if the source of the content does not already provide one. The returned streams are optimized for memory usage and performance. The position is set to the beginning of the stream when returned.
GetDocument() IDocument
Gets a new document with default initial metadata.
GetDocument(FilePath, IEnumerable<KeyValuePair<string, Object>>) IDocument
Gets a new document with the specified source and metadata (in addition to the default initial metadata).
GetDocument(FilePath, Stream, IEnumerable<KeyValuePair<string, Object>>, bool) IDocument
Gets a new document with the specified source, content stream, and metadata (in addition to the default initial metadata). If disposeStream is true (which it is by default), the provided System.IO.Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the System.IO.Stream).
GetDocument(FilePath, string, IEnumerable<KeyValuePair<string, Object>>) IDocument
GetDocument(IDocument, FilePath, IEnumerable<KeyValuePair<string, Object>>) IDocument
Clones the specified source document with a new source and additional metadata (all existing metadata is retained) or gets a new document if the source document is null or AsNewDocuments() was called on the module.
GetDocument(IDocument, FilePath, Stream, IEnumerable<KeyValuePair<string, Object>>, bool) IDocument
Clones the specified source document with a new source, new content stream, and additional metadata (all existing metadata is retained) or gets a new document if the source document is null or AsNewDocuments() was called on the module. If disposeStream is true (which it is by default), the provided System.IO.Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the System.IO.Stream).
GetDocument(IDocument, FilePath, string, IEnumerable<KeyValuePair<string, Object>>) IDocument
GetDocument(IDocument, IEnumerable<KeyValuePair<string, Object>>) IDocument
Clones the specified source document with identical content and additional metadata (all existing metadata is retained) or gets a new document if the source document is null or AsNewDocuments() was called on the module.
GetDocument(IDocument, Stream, IEnumerable<KeyValuePair<string, Object>>, bool) IDocument
Clones the specified source document with a new content stream, and additional metadata (all existing metadata is retained) or gets a new document if the source document is null or AsNewDocuments() was called on the module. If disposeStream is true (which it is by default), the provided System.IO.Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the System.IO.Stream).
GetDocument(IDocument, string, IEnumerable<KeyValuePair<string, Object>>) IDocument
GetDocument(IEnumerable<KeyValuePair<string, Object>>) IDocument
Gets a new document with the specified metadata (in addition to the default initial metadata).
GetDocument(Stream, IEnumerable<KeyValuePair<string, Object>>, bool) IDocument
Gets a new document with the specified content stream and metadata (in addition to the default initial metadata). If disposeStream is true (which it is by default), the provided System.IO.Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the System.IO.Stream).
GetDocument(string, IEnumerable<KeyValuePair<string, Object>>) IDocument
GetEnumerator() IEnumerator<KeyValuePair<string, Object>>
GetJavaScriptEnginePool(Action<IJavaScriptEngine>, int, int, int, Nullable<TimeSpan>) IJavaScriptEnginePool
Gets a new Wyam.Common.JavaScript.IJavaScriptEnginePool. The returned engine pool should be disposed when no longer needed.
GetMetadata(string[]) IMetadata
Gets a new Wyam.Common.Meta.IMetadata containing only the specified keys and their values. If a key is not present in the current metadata, it will be ignored and will not be copied to the new metadata object.
GetRaw(string) Object
Gets the raw value for the specified key. This method will not materialize Wyam.Common.Meta.IMetadataValue values the way Wyam.Common.Meta.IMetadata.Get(System.String,System.Object) will. A System.Collections.Generic.KeyNotFoundException will be thrown for missing keys.
GetShortcodeResult(Stream, IEnumerable<KeyValuePair<string, Object>>) IShortcodeResult
A factory method for use from inside an Wyam.Common.Shortcodes.IShortcode to create an Wyam.Common.Shortcodes.IShortcodeResult.
GetShortcodeResult(string, IEnumerable<KeyValuePair<string, Object>>) IShortcodeResult
A factory method for use from inside an Wyam.Common.Shortcodes.IShortcode to create an Wyam.Common.Shortcodes.IShortcodeResult.
MetadataAs<T>() IMetadata<T>
Presents metadata values as a specific type (see Wyam.Common.Meta.IMetadata).
TryConvert<T>(Object, T) bool
Provides access to the same enhanced type conversion used to convert metadata types.
TryGetValue(string, Object) bool
TryGetValue<T>(string, T) bool
Tries to get the value for the specified key.
GitHub