• Guides
  • Api Reference
  • FAQ
  • Api Reference
  • FunctionMonkey.Testing
  • AbstractAcceptanceTest
Show / Hide Table of Contents
  • FunctionMonkey
    • AbstractPluginFunctions
    • ClaimMappingCompilationException
    • ConfigurationException
    • DeserializationException
    • PluginFunctions
    • Runtime
    • RuntimeInstance
    • TypeLoadingException
  • FunctionMonkey.Abstractions
    • HttpResponse
    • IClaimsPrincipalAuthorization
    • ICommandClaimsBinder
    • ICommandingConfigurator
    • ICommandTransformer
    • IContextProvider
    • IContextSetter
    • IFunctionAppConfiguration
    • IFunctionAppHost
    • IFunctionCompilerMetadata
    • IMediatorDecorator
    • IMediatorResultTypeExtractor
    • IMediatorTypeSafetyEnforcer
    • IOutputBindingConverter
    • ISerializer
    • ITimerCommandFactory<TCommand>
    • ITokenValidator
    • TokenValidationResult
  • FunctionMonkey.Abstractions.Builders
    • AuthorizationTypeEnum
    • IAuthorizationBuilder
    • IClaimsMappingBuilder
    • IClientCompilerOptionsBuilder
    • ICompilerOptionsBuilder
    • ICosmosDbFunctionBuilder
    • ICosmosDbFunctionOptionBuilder<TCommand>
    • IEventHubFunctionBuilder
    • IEventHubFunctionOptionBuilder<TCommand>
    • IFunctionAppHostBuilder
    • IFunctionBuilder
    • IFunctionHostBuilder
    • IFunctionOptions<TParentBuilder, TFunctionOptionsBuilder>
    • IFunctionOptionsBuilder
    • IHttpFunctionBuilder
    • IHttpFunctionConfigurationBuilder<TCommand>
    • IHttpFunctionOptionsBuilder<TCommand>
    • IHttpRouteFunctionBuilder
    • IHttpRouteOptionsBuilder
    • IOpenApiBuilder
    • IOpenApiDocumentFilter
    • IOpenApiDocumentFilterContext
    • IOpenApiOperationFilter
    • IOpenApiOperationFilterContext
    • IOpenApiParameterFilter
    • IOpenApiParameterFilterContext
    • IOpenApiSchemaFilter
    • IOpenApiSchemaFilterContext
    • IOutputBindingBuilder<TFunctionTypeBuilder>
    • ISerializationBuilder
    • IServiceBusFunctionBuilder
    • IServiceBusFunctionOptionBuilder<TCommand>
    • ISignalRFunctionBuilder
    • ISignalRFunctionConfigurationBuilder<TCommand>
    • IStorageFunctionBuilder
    • IStorageFunctionOptionBuilder<TCommand>
    • ITimerFunctionBuilder
    • ITimerFunctionOptionsBuilder<TCommand>
  • FunctionMonkey.Abstractions.Builders.Model
    • AbstractFunctionDefinition
    • AbstractOutputBinding
    • BridgedFunction
    • ConnectionStringSettingNames
    • HeaderBindingConfiguration
  • FunctionMonkey.Abstractions.Contexts
    • BlobContext
    • EventHubContext
    • ExecutionContext
    • HttpContext
    • ServiceBusContext
    • StorageQueueContext
  • FunctionMonkey.Abstractions.Extensions
    • TypeExtensions
  • FunctionMonkey.Abstractions.Http
    • AbstractClaimsMappingDefinition
    • CommandPropertyClaimsMappingDefinition
    • IHttpResponseHandler
    • OpenApiConfiguration
    • SharedClaimsMappingDefinition
  • FunctionMonkey.Abstractions.SignalR
    • GroupActionEnum
    • SignalRGroupAction
    • SignalRMessage
  • FunctionMonkey.Abstractions.Validation
    • IValidator
  • FunctionMonkey.AspNetCore
    • AuthenticationBuilderExtensions
    • AuthenticationOptions
    • FunctionMonkeyAuthHandler
    • IWebHostBuilderExtensions
    • JsonSecurityPropertyContractResolver
    • TokenValidatedContext
    • TokenValidationDefaults
  • FunctionMonkey.Builders
    • ClientCompilerOptionsBuilder
    • CosmosDbFunctionOptionBuilder<TCommandOuter>
    • FunctionBuilder
    • HttpFunctionOptionsBuilder<TCommand>
    • SerializationBuilder
    • StorageFunctionOptionBuilder<TCommandOuter>
  • FunctionMonkey.Commanding.Abstractions
    • ICommandWithNoHandler
    • IgnorePropertyAttribute
    • IStreamCommand
    • SignalRNegotiateResponse
  • FunctionMonkey.Commanding.Abstractions.Validation
    • SeverityEnum
    • ValidationError
    • ValidationException
    • ValidationObjectException
    • ValidationResult
    • ValidationResult<TResult>
  • FunctionMonkey.Commanding.Cosmos.Abstractions
    • ICosmosDbDocumentBatchCommand
    • ICosmosDbDocumentCommand
    • ICosmosDbErrorHandler
  • FunctionMonkey.Extensions
    • ServiceCollectionExtensions
    • Utils
  • FunctionMonkey.FluentValidation
    • IFunctionHostBuilderExtensions
    • IOpenApiBuilderExtensions
    • IServiceCollectionExtensions
  • FunctionMonkey.FluentValidation.OpenApi
    • OpenApiFluentValidationHelper
    • OpenApiFluentValidationRule
    • OpenApiFluentValidationRuleContext
  • FunctionMonkey.Infrastructure
    • DefaultMediatorTypeSafetyEnforcer
  • FunctionMonkey.MediatR
    • IFunctionHostBuilderExtensions
    • MediatRResultTypeExtractor
    • MediatRTypeSafetyEnforcer
  • FunctionMonkey.Serialization
    • CamelCaseJsonSerializer
    • DefaultCaseJsonSerializer
    • JsonSecurityPropertyContractResolver
    • NamingStrategyJsonSerializer
    • SecurityPropertyDefaultValueConverter
    • SnakeCaseJsonSerializer
  • FunctionMonkey.SignalR
    • AzureSignalRAuthClient
    • Converter
  • FunctionMonkey.Testing
    • AbstractAcceptanceTest
    • AcceptanceTestScaffold
    • HttpResponseExtensions
    • TestException
    • ValidatingDispatcher
    • ValidationException
  • FunctionMonkey.Testing.Mocks
    • CommandClaimsBinderMock
    • ContextManagerMock
  • FunctionMonkey.TokenValidator
    • IAuthorizationBuilderExtensions
  • FunctionMonkey.TokenValidator.Implementation
    • TokenValidator
  • SimpleJson
    • IJsonSerializerStrategy
    • JsonArray
    • JsonObject
    • PocoJsonSerializerStrategy
    • SimpleJson

Class AbstractAcceptanceTest

A class that can be used as a basis for running acceptance tests with Function Monkey at the command dispatch level designed for use with test frameworks that take a constructor approach to

One of the advantages of the pattern used by Function Monkey is that the host function triggers are separated cleanly from business logic and compiled with pre-tested templates allowing for comprehensive acceptance tests to be run just below this level which can often provide a high level of value with a lower level of complexity than also testing the Function triggers.

Typically the none-generic version of this class is more useful but this version allows for a custom IFunctionHostBuilder to be used if additional functionality is required over and above that baked into the supplied TestFunctionHostBuilder which solely handles command registration and dependency injection management.

Inheritance
System.Object
AbstractAcceptanceTest
Namespace: FunctionMonkey.Testing
Assembly: FunctionMonkey.Testing.dll
Syntax
public abstract class AbstractAcceptanceTest : object

Constructors

| Improve this Doc View Source

AbstractAcceptanceTest()

Declaration
protected AbstractAcceptanceTest()

Properties

| Improve this Doc View Source

Dispatcher

Provides access to the command dispatcher registered in the service provider but wrapped in a decorator that implements validation.

Declaration
public ICommandDispatcher Dispatcher { get; }
Property Value
Type Description
ICommandDispatcher
| Improve this Doc View Source

ServiceProvider

The constructed service provider

Declaration
public IServiceProvider ServiceProvider { get; }
Property Value
Type Description
IServiceProvider

Methods

| Improve this Doc View Source

AddEnvironmentVariables(Stream, Boolean)

Set up environment variables based on a settings.json file in a stream

Declaration
protected void AddEnvironmentVariables(Stream appSettings, bool oneTimeOnly = true)
Parameters
Type Name Description
Stream appSettings
System.Boolean oneTimeOnly
| Improve this Doc View Source

AddEnvironmentVariables(String, Boolean)

Set up environment variables based on a settings.json filename

Declaration
protected void AddEnvironmentVariables(string appSettingsPath, bool oneTimeOnly = true)
Parameters
Type Name Description
System.String appSettingsPath
System.Boolean oneTimeOnly
| Improve this Doc View Source

BeforeServiceProviderBuild(IServiceCollection, ICommandRegistry)

This method can be used to modify dependency and command setup before the service provider has been built from the service collection.

This must not access members (and should not need to) as it is invoked from the constructor to support test frameworks such as XUnit that construct test cases this way.

Declaration
public virtual void BeforeServiceProviderBuild(IServiceCollection serviceCollection, ICommandRegistry commandRegistry)
Parameters
Type Name Description
IServiceCollection serviceCollection
ICommandRegistry commandRegistry
| Improve this Doc View Source

BeforeSetup()

Called during construction before setup is called (overriding methods cannot use member data)

Declaration
protected virtual void BeforeSetup()
| Improve this Doc View Source

ExecuteHttpAsync(ICommand, HttpMethod)

Runs a command through the IActionResult ASP.Net pathways and returns a HTTP response. This is useful for testing end to end HTTP triggered functions without having to actually host the function app. A method only needs specifying in the function supports multiple methods.

Declaration
public Task<HttpResponse> ExecuteHttpAsync(ICommand command, HttpMethod method = null)
Parameters
Type Name Description
ICommand command
HttpMethod method
Returns
Type Description
Task<HttpResponse>
| Improve this Doc View Source

ExecuteHttpAsync<TResult>(ICommand<TResult>, HttpMethod)

Runs a command through the IActionResult ASP.Net pathways and returns a HTTP response. This is useful for testing end to end HTTP triggered functions without having to actually host the function app. A method only needs specifying in the function supports multiple methods.

Declaration
public Task<HttpResponse> ExecuteHttpAsync<TResult>(ICommand<TResult> command, HttpMethod method = null)
Parameters
Type Name Description
ICommand<TResult> command
HttpMethod method
Returns
Type Description
Task<HttpResponse>
Type Parameters
Name Description
TResult

Extension Methods

OpenApiFluentValidationHelper.IsNumeric(Object)
OpenApiFluentValidationHelper.NumericToInt(Object)
OpenApiFluentValidationHelper.NumericToDouble(Object)
OpenApiFluentValidationHelper.NumericToDecimal(Object)
  • Improve this Doc
  • View Source
  • 0 Comments
In This Article
  • Constructors
    • AbstractAcceptanceTest()
  • Properties
    • Dispatcher
    • ServiceProvider
  • Methods
    • AddEnvironmentVariables(Stream, Boolean)
    • AddEnvironmentVariables(String, Boolean)
    • BeforeServiceProviderBuild(IServiceCollection, ICommandRegistry)
    • BeforeSetup()
    • ExecuteHttpAsync(ICommand, HttpMethod)
    • ExecuteHttpAsync<TResult>(ICommand<TResult>, HttpMethod)
  • Extension Methods
Back to top Copyright © 2018 James Randall