Example #1
0
        /// <inheritdoc/>
        public override bool IsProfileValid(Data.CompatibilityProfileData profileData, out IEnumerable <Exception> errors)
        {
            CompatibilityProfileData queryableProfile;

            try
            {
                queryableProfile = new CompatibilityProfileData(profileData);
            }
            catch (Exception e)
            {
                errors = new [] { e };
                return(false);
            }

            try
            {
                _psVersionMajor = queryableProfile.Platform.PowerShell.Version.Major;
                ValidatePlatformData(queryableProfile.Id, queryableProfile.Platform);
            }
            catch (Exception e)
            {
                _errAcc.AddError(e);
            }

            try
            {
                ValidateRuntimeData(queryableProfile.Runtime);
            }
            catch (Exception e)
            {
                _errAcc.AddError(e);
            }

            if (_errAcc.HasErrors())
            {
                errors = _errAcc.GetErrors();
                return(false);
            }

            errors = null;
            return(true);
        }
Example #2
0
 /// <summary>
 /// Check if a PowerShell compatibility profile is valid.
 /// </summary>
 /// <param name="profileData">The compatibility profile to check.</param>
 /// <param name="validationErrors">All errors encountered with the validation. May be null when true is returned.</param>
 /// <returns>True if the profile is valid, false otherwise.</returns>
 public abstract bool IsProfileValid(Data.CompatibilityProfileData profileData, out IEnumerable <Exception> validationErrors);