File tree Expand file tree Collapse file tree 2 files changed +29
-10
lines changed Expand file tree Collapse file tree 2 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -8,25 +8,24 @@ public class GridViewSort<T>
8
8
private bool _sortedAscending ;
9
9
private string _columnName ;
10
10
11
- public GridViewSort ( string ColumnName , bool SortedAscending )
11
+ public GridViewSort ( string columnName , bool sortedAscending )
12
12
{
13
- _columnName = ColumnName ;
14
- _sortedAscending = SortedAscending ;
13
+ _columnName = columnName ;
14
+ _sortedAscending = sortedAscending ;
15
15
}
16
16
17
- public IEnumerable < T > Sort ( IEnumerable < T > Items , string ColumnName )
17
+ public IEnumerable < T > Sort ( IEnumerable < T > items , string columnName )
18
18
{
19
- if ( ColumnName == _columnName && _sortedAscending )
19
+ if ( columnName == _columnName && _sortedAscending )
20
20
{
21
21
_sortedAscending = false ;
22
- var test = Items . Select ( x => x . GetType ( ) . GetProperty ( ColumnName ) . GetValue ( x ) ) ;
23
- return Items . OrderByDescending ( x => x . GetType ( ) . GetProperty ( ColumnName ) . GetValue ( x ) ) ;
22
+ return items . OrderByDescending ( x => x . GetType ( ) . GetProperty ( columnName ) . GetValue ( x ) ) ;
24
23
}
25
24
else
26
25
{
27
- _columnName = ColumnName ;
26
+ _columnName = columnName ;
28
27
_sortedAscending = true ;
29
- return Items . OrderBy ( x => x . GetType ( ) . GetProperty ( ColumnName ) . GetValue ( x ) ) ;
28
+ return items . OrderBy ( x => x . GetType ( ) . GetProperty ( columnName ) . GetValue ( x ) ) ;
30
29
}
31
30
}
32
31
}
Original file line number Diff line number Diff line change 1
- using System . Collections . Generic ;
1
+ using System ;
2
+ using System . Collections . Generic ;
2
3
using Microsoft . VisualStudio . TestTools . UnitTesting ;
3
4
using Moq ;
4
5
using Rubberduck . Settings ;
@@ -109,5 +110,24 @@ public void MarkerChangeSavedOnPriorityChanged()
109
110
110
111
Assert . AreEqual ( view . ActiveMarkerPriority , view . TodoMarkers [ 0 ] . Priority ) ;
111
112
}
113
+
114
+ [ TestMethod ]
115
+ public void RemoveReallyDoesRemoveSelectedItem ( )
116
+ {
117
+ var markers = GetTestMarkers ( ) ;
118
+
119
+ var view = new TodoListSettingsUserControl ( markers , new Mock < GridViewSort < ToDoMarker > > ( "" , false ) . Object ) ;
120
+ view . RemoveMarker += RemoveParam ;
121
+ view . SelectedIndex = 2 ;
122
+
123
+ RemoveParam ( null , EventArgs . Empty ) ;
124
+
125
+ Assert . AreEqual ( 2 , view . TodoMarkers . Count ) ;
126
+ }
127
+
128
+ private void RemoveParam ( object sender , EventArgs e )
129
+ {
130
+
131
+ }
112
132
}
113
133
}
You can’t perform that action at this time.
0 commit comments