Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="xObject"></param>
        /// <param name="yObject"></param>
        /// <returns></returns>
        public int Compare(object xObject, object yObject)
        {
            if (IsNull(xObject) && IsNull(yObject))
            {
                return(0);
            }
            else if (IsNull(xObject))
            {
                return(-1);
            }
            else if (IsNull(yObject))
            {
                return(1);
            }

            VersionInfo xClientVersion = xObject as VersionInfo;
            VersionInfo yClientVersion = yObject as VersionInfo;

            if (IsNull(xClientVersion) || IsNull(yClientVersion))
            {
                throw new ArgumentException();
            }

            return(xClientVersion.CompareTo(yClientVersion));
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="xClientVersion"></param>
        /// <param name="yClientVersion"></param>
        /// <returns></returns>
        public static int Compare(VersionInfo xClientVersion, VersionInfo yClientVersion)
        {
            if (IsNull(xClientVersion) && IsNull(yClientVersion))
            {
                return(0);
            }
            else if (IsNull(xClientVersion))
            {
                return(-1);
            }
            else if (IsNull(yClientVersion))
            {
                return(1);
            }

            return(xClientVersion.CompareTo(yClientVersion));
        }
 public void CompareToTest()
 {
     string strFormat = string.Empty; // TODO: 初始化为适当的值
     VersionInfo target = new VersionInfo( strFormat ); // TODO: 初始化为适当的值
     object xObject = null; // TODO: 初始化为适当的值
     int expected = 0; // TODO: 初始化为适当的值
     int actual;
     actual = target.CompareTo( xObject );
     Assert.AreEqual( expected, actual );
     Assert.Inconclusive( "验证此测试方法的正确性。" );
 }
Esempio n. 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="xClientVersion"></param>
        /// <param name="yClientVersion"></param>
        /// <returns></returns>
        public static int Compare( VersionInfo xClientVersion, VersionInfo yClientVersion )
        {
            if ( IsNull( xClientVersion ) && IsNull( yClientVersion ) )
                return 0;
            else if ( IsNull( xClientVersion ) )
                return -1;
            else if ( IsNull( yClientVersion ) )
                return 1;

            return xClientVersion.CompareTo( yClientVersion );
        }