Esempio n. 1
0
            // ReSharper disable once UnusedParameter.Local
            internal static void ReadonlyMemberDiffers(
                SourceAndTargetValue sourceAndTargetValue,
                MemberInfo member,
                MemberSettings settings)
            {
                var error = new ReadonlyMemberDiffersError(sourceAndTargetValue, member);
                var typeErrors = new TypeErrors(sourceAndTargetValue.Source?.GetType(), error);

                var message = typeErrors.GetErrorText(settings, typeof(Copy).Name, settings.CopyMethodName());
                throw new InvalidOperationException(message);
            }
Esempio n. 2
0
            // ReSharper disable once UnusedParameter.Local
            internal static void ReadonlyMemberDiffers(
                SourceAndTargetValue sourceAndTargetValue,
                MemberInfo member,
                MemberSettings settings)
            {
                var error      = new ReadonlyMemberDiffersError(sourceAndTargetValue, member);
                var typeErrors = new TypeErrors(sourceAndTargetValue.Source?.GetType(), error);

                var message = typeErrors.GetErrorText(settings, typeof(Copy).Name, settings.CopyMethodName());

                throw new InvalidOperationException(message);
            }
Esempio n. 3
0
            internal static void CanCopyMemberValues <T>(T x, T y, MemberSettings settings)
            {
                var type = x?.GetType() ?? y?.GetType() ?? typeof(T);

                CanCopyMemberValues(type, settings, typeof(Copy).Name, settings.CopyMethodName());
            }
Esempio n. 4
0
            internal static InvalidOperationException CreateCannotCreateInstanceException(
                object sourceValue,
                MemberSettings settings,
                Exception exception)
            {
                var cannotCopyError = new CannotCreateInstanceError(sourceValue);
                var typeErrors      = new TypeErrors(sourceValue.GetType(), new Error[] { cannotCopyError });
                var message         = typeErrors.GetErrorText(settings, typeof(Copy).Name, settings.CopyMethodName());

                return(new InvalidOperationException(message, exception));
            }
Esempio n. 5
0
            // ReSharper disable once UnusedParameter.Local
            internal static Exception CannotCopyFixesSizeCollections(
                IEnumerable source,
                IEnumerable target,
                MemberSettings settings)
            {
                var error      = new CannotCopyFixedSizeCollectionsError(source, target);
                var typeErrors = new TypeErrors(target.GetType(), error);
                var message    = typeErrors.GetErrorText(settings, typeof(Copy).Name, settings.CopyMethodName());

                return(new InvalidOperationException(message));
            }
Esempio n. 6
0
 internal static InvalidOperationException CreateCannotCreateInstanceException(
     object sourceValue,
     MemberSettings settings,
     Exception exception)
 {
     var cannotCopyError = new CannotCreateInstanceError(sourceValue);
     var typeErrors = new TypeErrors(sourceValue.GetType(), new Error[] { cannotCopyError });
     var message = typeErrors.GetErrorText(settings, typeof(Copy).Name, settings.CopyMethodName());
     return new InvalidOperationException(message, exception);
 }
Esempio n. 7
0
 // ReSharper disable once UnusedParameter.Local
 internal static Exception CannotCopyFixesSizeCollections(
     IEnumerable source,
     IEnumerable target,
     MemberSettings settings)
 {
     var error = new CannotCopyFixedSizeCollectionsError(source, target);
     var typeErrors = new TypeErrors(target.GetType(), error);
     var message = typeErrors.GetErrorText(settings, typeof(Copy).Name, settings.CopyMethodName());
     return new InvalidOperationException(message);
 }