44using Behavioral . Automation . Elements ;
55using Behavioral . Automation . FluentAssertions ;
66using Behavioral . Automation . Model ;
7+ using Behavioral . Automation . Services ;
78using JetBrains . Annotations ;
89using TechTalk . SpecFlow ;
910
@@ -92,7 +93,7 @@ public void CheckDropdownContainsItems(
9293 Assert . ShouldBecome (
9394 ( ) => wrapper . Items . Contains ( value ) ,
9495 ! behavior . Contains ( "not" ) ,
95- $ " { wrapper . Caption } items are { wrapper . Items . Aggregate ( ( x , y ) => $ " { x } , { y } " ) } " ) ;
96+ wrapper . Items . CreateDropdownErrorMessage ( wrapper . Caption ) ) ;
9697 }
9798
9899 /// <summary>
@@ -111,15 +112,15 @@ public void CheckDropdownContainsItems(
111112 [ Then ( "the \" (.*?)\" menu should (contain|not contain) the following values:" ) ]
112113 public void CheckDropdownContainsMultipleItems ( [ NotNull ] IDropdownWrapper wrapper , [ NotNull ] string behavior , [ NotNull ] Table table )
113114 {
114- Assert . ShouldBecome ( ( ) => table . Rows . Any ( ) , true ,
115+ Assert . ShouldBecome ( ( ) => table . Rows . Any ( ) , true ,
115116 new AssertionBehavior ( AssertionType . Immediate , false ) , "Please provide data in the table" ) ;
116117
117- var dropdownItems = wrapper . Items ;
118+ var dropdownItems = wrapper . Items . ToArray ( ) ;
118119 foreach ( var row in table . Rows )
119120 {
120121 var value = row . Values . FirstOrDefault ( ) ;
121- Assert . ShouldBecome ( ( ) => dropdownItems . Contains ( value ) , ! behavior . Contains ( "not" ) ,
122- $ " { wrapper . Caption } items are { dropdownItems . Aggregate ( ( x , y ) => $ " { x } , { y } " ) } " ) ;
122+ Assert . ShouldBecome ( ( ) => dropdownItems . Contains ( value ) , ! behavior . Contains ( "not" ) ,
123+ dropdownItems . CreateDropdownErrorMessage ( wrapper . Caption ) ) ;
123124 }
124125 }
125126
@@ -140,7 +141,7 @@ public void CheckAllItemsContainString(
140141 Assert . ShouldBecome ( ( ) => wrapper . Stale , false , $ "{ wrapper . Caption } is stale") ;
141142 var items = wrapper . Items ;
142143 Assert . ShouldBecome ( ( ) => wrapper . Items . All ( x => x . ToLower ( ) . Contains ( value . ToLower ( ) . Trim ( ) ) ) ,
143- ! behavior . Contains ( "not" ) , $ " { wrapper . Caption } items are { items . Aggregate ( ( x , y ) => $ " { x } , { y } " ) } " ) ;
144+ ! behavior . Contains ( "not" ) , items . CreateDropdownErrorMessage ( wrapper . Caption ) ) ;
144145 }
145146
146147 /// <summary>
@@ -258,7 +259,7 @@ private void CheckDropdownValueCollectionEnabled([NotNull] string behavior,
258259 [ Then ( "no values should be selected in (.*?):" ) ]
259260 public void CheckMultiSelectDropdownHasNoValuesSelected ( [ NotNull ] IMultiSelectDropdownWrapper wrapper )
260261 {
261- Assert . ShouldBecome ( ( ) => ! wrapper . SelectedValuesTexts . Any ( ) , true , $ " { wrapper . Caption } has the following values : { wrapper . SelectedValuesTexts . Aggregate ( ( x , y ) => $ " { x } , { y } " ) } " ) ;
262+ Assert . ShouldBecome ( ( ) => ! wrapper . SelectedValuesTexts . Any ( ) , true , wrapper . SelectedValuesTexts . CreateDropdownErrorMessage ( wrapper . Caption ) ) ;
262263 }
263264
264265 /// <summary>
0 commit comments