Example #1
0
        public void TryNewParameterLess()
        {
            ConstructorTestHelpers.TryNewParameterLess(
                (out object instance, out Exception exception) =>
            {
                var immediateType = new ImmediateType(typeof(ParamsOnlyConstructor));
                return(immediateType.TryNew(out instance, out exception));
            },
                () => new ParamsOnlyConstructor());

            ConstructorTestHelpers.TryNewParameterLess(
                (out object instance, out Exception exception) =>
            {
                var immediateType = new ImmediateType(typeof(IntParamsOnlyConstructor));
                return(immediateType.TryNew(out instance, out exception));
            },
                () => new IntParamsOnlyConstructor());

            ConstructorTestHelpers.TryNewParameterLess(
                (out object instance, out Exception exception) =>
            {
                var immediateType = new ImmediateType(typeof(NullableIntParamsOnlyConstructor));
                return(immediateType.TryNew(out instance, out exception));
            },
                () => new NullableIntParamsOnlyConstructor());
        }
Example #2
0
 public void TryNewParameterLess([NotNull] Type type, bool expectFail)
 {
     ConstructorTestHelpers.TryNewParameterLess(
         type,
         expectFail,
         (out object instance, out Exception exception) => TypeExtensions.TryNew(type, out instance, out exception));
 }
Example #3
0
 public void TryNewParameterLess([NotNull] Type type, bool expectFail)
 {
     ConstructorTestHelpers.TryNewParameterLess(
         type,
         expectFail,
         (out object instance, out Exception exception) =>
     {
         var immediateType = new ImmediateType(type);
         return(immediateType.TryNew(out instance, out exception));
     });
 }
Example #4
0
        public void TryNewParameterLess()
        {
            ConstructorTestHelpers.TryNewParameterLess(
                (out object instance, out Exception exception) => TypeExtensions.TryNew(typeof(ParamsOnlyConstructor), out instance, out exception),
                () => new ParamsOnlyConstructor());

            ConstructorTestHelpers.TryNewParameterLess(
                (out object instance, out Exception exception) => TypeExtensions.TryNew(typeof(IntParamsOnlyConstructor), out instance, out exception),
                () => new IntParamsOnlyConstructor());

            ConstructorTestHelpers.TryNewParameterLess(
                (out object instance, out Exception exception) => TypeExtensions.TryNew(typeof(NullableIntParamsOnlyConstructor), out instance, out exception),
                () => new NullableIntParamsOnlyConstructor());
        }