From 22f45a7d1eacc1b7a8b687c950a72470f8b74f09 Mon Sep 17 00:00:00 2001 From: "dmytro.turushev" Date: Mon, 4 Jul 2016 18:33:46 +0300 Subject: [PATCH 1/2] AsContainer method functionality moved to internal to prevent problems in Get and Exist methods --- src/TestStack.White/UIItems/UIItem.cs | 9 +++++++++ src/TestStack.White/UIItems/WPFUIItems/WPFUIItem.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/TestStack.White/UIItems/UIItem.cs b/src/TestStack.White/UIItems/UIItem.cs index 5e2fe1e0..a3f23140 100644 --- a/src/TestStack.White/UIItems/UIItem.cs +++ b/src/TestStack.White/UIItems/UIItem.cs @@ -526,6 +526,15 @@ public virtual void ActionPerformed(Action action) /// /// Returns an if possibe public virtual IUIItemContainer AsContainer() + { + return AsContainerInternal(); + } + + #endregion + + #region Internal + + internal virtual IUIItemContainer AsContainerInternal() { if (Framework != WindowsFramework.Wpf) { diff --git a/src/TestStack.White/UIItems/WPFUIItems/WPFUIItem.cs b/src/TestStack.White/UIItems/WPFUIItems/WPFUIItem.cs index 8d1ccd10..0c95cdc7 100644 --- a/src/TestStack.White/UIItems/WPFUIItems/WPFUIItem.cs +++ b/src/TestStack.White/UIItems/WPFUIItems/WPFUIItem.cs @@ -144,7 +144,7 @@ private static IUIItemContainer GetUiItemContainer(IUIItem uiItem) { throw new WhiteException("Cannot get UI Item container, uiItem must be an instance of UIItem"); } - return item.AsContainer(); + return item.AsContainerInternal(); } #endregion From 0fe63ee143c4bb1467088029fe936ed82759256a Mon Sep 17 00:00:00 2001 From: "dmytro.turushev" Date: Tue, 5 Jul 2016 16:50:15 +0300 Subject: [PATCH 2/2] Add explanation comment to AsContainerInternal method --- src/TestStack.White/UIItems/UIItem.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/TestStack.White/UIItems/UIItem.cs b/src/TestStack.White/UIItems/UIItem.cs index a3f23140..902b10d0 100644 --- a/src/TestStack.White/UIItems/UIItem.cs +++ b/src/TestStack.White/UIItems/UIItem.cs @@ -536,6 +536,9 @@ public virtual IUIItemContainer AsContainer() internal virtual IUIItemContainer AsContainerInternal() { + // This function needs to be internal because all public method from this + // class call interceptors. Sometimes we don't need focus on element, for + // example in GetMultiple method, so this method created for internal usage. if (Framework != WindowsFramework.Wpf) { Logger.Warn("Only WPF items should be treated as container items");