This is a migrated thread and some comments may be shown as answers.
UnitTesting(Xunit)-ListBox
0 Answers 5 Views
This is a migrated thread and some comments may be shown as answers.
Kishorekumar
Top achievements
Rank 1
Kishorekumar asked on 18 Jan 2021, 09:07 AM

Hi All,

I Used telerik:ListBox Control which has selection changed Event and for this event I was writing Unit Test code(X-Unit).

VM Code:

var selectionChangedEventArg = parameter as System.Windows.Controls.SelectionChangedEventArgs; 
                if (selectionChangedEventArg != null && selectionChangedEventArg.OriginalSource != null)
                {}

TEST CODE:

////Arrange

 System.Windows.Controls.SelectionChangedEventArgs obj =
            new System.Windows.Controls.SelectionChangedEventArgs(routedEvent, removedItems, addedItems);

////Act

detailViewModel.SelectionChangedCommand.Execute(obj);      

 

selectionChangedEventArg.OriginalSource was null when the method is called from Test method. Any idea to make the original Source has value.

No answers yet. Maybe you can help?

Asked by
Kishorekumar
Top achievements
Rank 1
Share this question
or