Example #1
0
 public void Copy([NotNull] Type type, [CanBeNull] object other)
 {
     ConstructorTestHelpers.Copy(
         type,
         other,
         o => TypeExtensions.Copy(type, o));
 }
Example #2
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 #3
0
        public void NewParamsOnly()
        {
            ConstructorTestHelpers.NewParamsOnly(
                () =>
            {
                var immediateType = new ImmediateType(typeof(ParamsOnlyConstructor));
                return(immediateType.New());
            },
                () => new ParamsOnlyConstructor());

            ConstructorTestHelpers.NewParamsOnly(
                () =>
            {
                var immediateType = new ImmediateType(typeof(IntParamsOnlyConstructor));
                return(immediateType.New());
            },
                () => new IntParamsOnlyConstructor());

            ConstructorTestHelpers.NewParamsOnly(
                () =>
            {
                var immediateType = new ImmediateType(typeof(NullableIntParamsOnlyConstructor));
                return(immediateType.New());
            },
                () => new NullableIntParamsOnlyConstructor());
        }
Example #4
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 #5
0
 public void NewWithParameters([NotNull] Type type, [CanBeNull, ItemCanBeNull] params object[] arguments)
 {
     ConstructorTestHelpers.NewWithParameters(
         type,
         args => TypeExtensions.New(type, args),
         arguments);
 }
Example #6
0
 public void TryCopy([NotNull] Type type, [CanBeNull] object other, bool expectFail)
 {
     ConstructorTestHelpers.TryCopy(
         type,
         other,
         expectFail,
         (object o, out object instance, out Exception exception) => TypeExtensions.TryCopy(type, o, out instance, out exception));
 }
Example #7
0
 public void TryNewWithParameters([NotNull] Type type, bool expectFail, [CanBeNull, ItemCanBeNull] params object[] arguments)
 {
     ConstructorTestHelpers.TryNewWithParameters(
         type,
         expectFail,
         (out object instance, out Exception exception, object[] args) => TypeExtensions.TryNew(type, out instance, out exception, args),
         arguments);
 }
Example #8
0
 public void NewParameterLess([NotNull] Type type)
 {
     ConstructorTestHelpers.NewParameterLess(
         type,
         () =>
     {
         var immediateType = new ImmediateType(type);
         return(immediateType.New());
     });
 }
Example #9
0
 public void Copy([NotNull] Type type, [CanBeNull] object other)
 {
     ConstructorTestHelpers.Copy(
         type,
         other,
         o =>
     {
         var immediateType = new ImmediateType(type);
         return(immediateType.Copy(o));
     });
 }
Example #10
0
 public void NewWithParameters([NotNull] Type type, [CanBeNull, ItemCanBeNull] params object[] arguments)
 {
     ConstructorTestHelpers.NewWithParameters(
         type,
         args =>
     {
         var immediateType = new ImmediateType(type);
         return(immediateType.New(args));
     },
         arguments);
 }
Example #11
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 #12
0
 public void TryNewWithParameters([NotNull] Type type, bool expectFail, [CanBeNull, ItemCanBeNull] params object[] arguments)
 {
     ConstructorTestHelpers.TryNewWithParameters(
         type,
         expectFail,
         (out object instance, out Exception exception, object[] args) =>
     {
         var immediateType = new ImmediateType(type);
         return(immediateType.TryNew(out instance, out exception, args));
     },
         arguments);
 }
Example #13
0
 public void TryCopy([NotNull] Type type, [CanBeNull] object other, bool expectFail)
 {
     ConstructorTestHelpers.TryCopy(
         type,
         other,
         expectFail,
         (object o, out object instance, out Exception exception) =>
     {
         var immediateType = new ImmediateType(type);
         return(immediateType.TryCopy(o, out instance, out exception));
     });
 }
Example #14
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());
        }
Example #15
0
        public void NewParamsOnly()
        {
            ConstructorTestHelpers.NewParamsOnly(
                () => TypeExtensions.New(typeof(ParamsOnlyConstructor)),
                () => new ParamsOnlyConstructor());

            ConstructorTestHelpers.NewParamsOnly(
                () => TypeExtensions.New(typeof(IntParamsOnlyConstructor)),
                () => new IntParamsOnlyConstructor());

            ConstructorTestHelpers.NewParamsOnly(
                () => TypeExtensions.New(typeof(NullableIntParamsOnlyConstructor)),
                () => new NullableIntParamsOnlyConstructor());
        }
Example #16
0
 public void NewParameterLess([NotNull] Type type)
 {
     ConstructorTestHelpers.NewParameterLess(
         type,
         () => TypeExtensions.New(type));
 }