MockerTestBase<(Of <(<'TComponent>)>)>..::..TestConstructorParameters Method (Action<(Of <(<'Action, String, String>)>)>, Nullable<(Of <(<'Func<(Of <(<'ParameterInfo, Nullable<(Of <(<'Object>)>)>>)>)>>)>)>, Nullable<(Of <(<'Func<(Of <(<'ParameterInfo, Nullable<(Of <(<'Object>)>)>>)>)>>)>)>)
Tests the constructor parameters.
Namespace:
FastMoqAssembly: FastMoq.Core (in FastMoq.Core.dll)
Syntax
protected void TestConstructorParameters( Action<Action, string, string> createAction, Nullable<Func<ParameterInfo, Nullable<Object>>> defaultValue, Nullable<Func<ParameterInfo, Nullable<Object>>> validValue )
Protected Sub TestConstructorParameters ( _ createAction As Action(Of Action, String, String), _ defaultValue As Nullable(Of Func(Of ParameterInfo, Nullable(Of Object))), _ validValue As Nullable(Of Func(Of ParameterInfo, Nullable(Of Object))) _ )
protected: void TestConstructorParameters( Action<Action^, String^, String^>^ createAction, Nullable<Func<ParameterInfo^, Nullable<Object^>>^> defaultValue, Nullable<Func<ParameterInfo^, Nullable<Object^>>^> validValue )
Parameters
- defaultValue
- Type: Nullable<(Of <(<'Func<(Of <(<'ParameterInfo, Nullable<(Of <(<'Object>)>)>>)>)>>)>)>
The default value.
- validValue
- Type: Nullable<(Of <(<'Func<(Of <(<'ParameterInfo, Nullable<(Of <(<'Object>)>)>>)>)>>)>)>
The valid value.
Examples
C#
[Fact] public void Service_NullArgChecks() => TestConstructorParameters((action, constructorName, parameterName) => { output?.WriteLine($"Testing {constructorName}\n - {parameterName}"); action .Should() .Throw<ArgumentNullException>() .WithMessage($"*{parameterName}*"); }); [Fact] public void Service_NullArgChecks() => TestConstructorParameters((action, constructorName, parameterName) => { output?.WriteLine($"Testing {constructorName}\n - {parameterName}"); action .Should() .Throw<ArgumentNullException>() .WithMessage($"*{parameterName}*"); }, info => { return info switch { { ParameterType: { Name: "string" }} => string.Empty, { ParameterType: { Name: "int" }} => -1, _ => default, }; }, info => { return info switch { { ParameterType: { Name: "string" }} => "Valid Value", { ParameterType: { Name: "int" }} => 22, _ => Mocks.GetObject(info.ParameterType), }; } );