0

将自动生成的代码从 UIMap.Designer.cs 复制到 UIMap.cs 后出现以下错误

'Test_7.UIReviewyourshoppingcaDocument.UIDJComboBox' 和 'Test_7.UIReviewyourshoppingcaDocument.UIDJComboBox' 之间的歧义

我在 codedUITestMethod 中的以下代码行中收到此错误-

Mouse.Click(this.UIMap.UIReviewyourshoppingcaWindow.UIReviewyourshoppingcaDocument.UIDJComboBox);

我想为我的编码 UI 测试创建自定义代码,但由于此错误,我无法这样做。

以下是我在 UIMap.cs 文件中移动的代码 -

    public class UIReviewyourshoppingcaDocument : HtmlDocument
    {
        #region Properties
        public HtmlComboBox UIDJComboBox
        {
            get
            {
                if ((this.mUIDJComboBox1 == null))
                {
                    this.mUIDJComboBox1 = new HtmlComboBox(this);
                    #region Search Criteria
                    this.mUIDJComboBox1.SearchProperties[HtmlComboBox.PropertyNames.Name] = "DJ";
                    this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.LabeledBy] = null;
                    this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.Size] = "0";
                    this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.Title] = "D J";
                    this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.ItemCount] = "52";
                    this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.Class] = "form-control control-width form-select DJ-required";
                    this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.ControlDefinition] = "name=\"DJ\" title=\"Dms";
                    this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.TagInstance] = "2";
                    this.mUIDJComboBox1.WindowTitles.Add("Review your shopping cart");
                    #endregion
                }
                return this.mUIDJComboBox1;
            }
        }
        #endregion

        #region Fields
        private HtmlComboBox mUIDJComboBox1;
        #endregion
    }
4

1 回答 1

0

尝试使用UI.uitest文件将方法移动到UIMap.cs 。如果您在保存UIMap.uitest文件时手动执行此操作,它将再次生成代码。因此,您会收到歧义错误。

这是单向任务,因为您可以将方法从UIMap.cs移动到UIMap.designer.cs

有关详细信息,请参阅此帖子:https ://msdn.microsoft.com/en-us/library/gg269473%28v=vs.100%29.aspx

于 2015-07-24T09:40:59.703 回答