コード例 #1
0
        /// <summary>
        /// A method used to verify types that are defined by protocol.
        /// </summary>
        /// <param name="resultByProtocol">A parameter represents an expected type list from protocol.</param>
        /// <param name="resultBySutAdapter">A parameter represents an actual type list from SUT adapter.</param>
        /// <returns>Return true value represents the protocol type list is same as script type list, else return false.</returns>
        public bool VerificationSutResultsAndProResults(ArrayOfString resultByProtocol, ArrayOfString resultBySutAdapter)
        {
            if (resultByProtocol == null)
            {
                throw new ArgumentException("The expected results must not be null or the count must not be 0.");
            }

            if (resultBySutAdapter == null)
            {
                throw new ArgumentException("The actual results must not be null or the count must not be 0.");
            }

            if (resultByProtocol.Count != resultBySutAdapter.Count)
            {
                return(false);
            }

            bool retValue = true;

            foreach (string sutItem in resultBySutAdapter)
            {
                if (!resultByProtocol.Any(protocolItem => protocolItem.Equals(sutItem, StringComparison.OrdinalIgnoreCase)))
                {
                    retValue = false;
                    this.Site.Log.Add(LogEntryKind.CheckFailed, "The actual item {0} is not in the protocol results.", sutItem);
                    break;
                }
            }

            if (retValue == true)
            {
                foreach (string protocolItem in resultByProtocol)
                {
                    if (!resultBySutAdapter.Any(sutItem => sutItem.Equals(protocolItem, StringComparison.OrdinalIgnoreCase)))
                    {
                        retValue = false;
                        this.Site.Log.Add(LogEntryKind.CheckFailed, "The expected item {0} is not in the SUT adapter results.", protocolItem);
                        break;
                    }
                }
            }

            return(retValue);
        }
コード例 #2
0
        /// <summary>
        /// A method used to verify types that are defined by protocol.
        /// </summary>
        /// <param name="resultByProtocol">A parameter represents an expected type list from protocol.</param>
        /// <param name="resultBySutAdapter">A parameter represents an actual type list from SUT adapter.</param>
        /// <returns>Return true value represents the protocol type list is same as script type list, else return false.</returns> 
        public bool VerificationSutResultsAndProResults(ArrayOfString resultByProtocol, ArrayOfString resultBySutAdapter)
        {
            if (resultByProtocol == null)
            {
                throw new ArgumentException("The expected results must not be null or the count must not be 0.");
            }

            if (resultBySutAdapter == null)
            {
                throw new ArgumentException("The actual results must not be null or the count must not be 0.");
            }

            if (resultByProtocol.Count != resultBySutAdapter.Count)
            {
                return false;
            }

            bool retValue = true;
            foreach (string sutItem in resultBySutAdapter)
            {
                if (!resultByProtocol.Any(protocolItem => protocolItem.Equals(sutItem, StringComparison.OrdinalIgnoreCase)))
                {
                    retValue = false;
                    this.Site.Log.Add(LogEntryKind.CheckFailed, "The actual item {0} is not in the protocol results.", sutItem);
                    break;
                }
            }

            if (retValue == true)
            {
                foreach (string protocolItem in resultByProtocol)
                {
                    if (!resultBySutAdapter.Any(sutItem => sutItem.Equals(protocolItem, StringComparison.OrdinalIgnoreCase)))
                    {
                        retValue = false;
                        this.Site.Log.Add(LogEntryKind.CheckFailed, "The expected item {0} is not in the SUT adapter results.", protocolItem);
                        break;
                    }
                }
            }

            return retValue;
        }