示例#1
0
        public void ValidateInterfaces()
        {
            List <string> files   = GetFileList();
            bool          success = true;

            foreach (string file in files)
            {
                LogHelper.Log("File {0} :", file);

                string     curPath       = ExtractFilePath(file, string.Empty, false);
                Interfaces curInterfaces = ValidationHelper.GetInterfaceObjects(curPath);

                List <string> versions = GetVersionList();
                foreach (string version in versions)
                {
                    LogHelper.Log("Version {0} :", version);
                    string     prePath       = ExtractFilePath(file, version, true);
                    Interfaces preInterfaces = ValidationHelper.GetInterfaceObjects(prePath);

                    LogHelper.Log("**************************************************************************");
                    LogHelper.Log("Comparing Interfaces:");
                    List <string> differences = preInterfaces.Compare(curInterfaces);
                    success &= (differences == null || differences.Count == 0);
                    LogHelper.Log("{0} interfaces are different.", (differences == null) ? 0 : differences.Count);

                    LogHelper.Log("Comparing Guid:");
                    if (curInterfaces != null && curInterfaces.SameGuidInterfaces.Count > 0)
                    {
                        success &= false;
                        foreach (KeyValuePair <Guid, List <string> > id in curInterfaces.SameGuidInterfaces)
                        {
                            LogHelper.Log("Guid id {0} is used in interfaces :", id.Key);
                            foreach (string s in id.Value)
                            {
                                LogHelper.Log(s);
                            }
                        }
                    }

                    LogHelper.Log("{0} Guids are duplicated.", curInterfaces.SameGuidInterfaces.Count);
                    LogHelper.Log("**************************************************************************");
                }
            }

            Assert.IsTrue(success, "Comparison completed. No interface is changed. No Guid is duplicated.");
        }