Getting Not Supported exception while subscribing to fetch IEnumerable collection data with the below code. Not able to subscribe the published Collection object.
Mock<IEventAggregator> _mockEventAgg = new Mock<IEventAggregator>();
_mockEventAgg.Setup(x => x.GetEvent<ShowScreenEvent>().Publish(new ObservableCollection<Customer>()
{
// Customer properties or details
}));
_mockEventAgg.Setup(m => m.GetEvent<ShowScreenEvent>().Subscribe(It.IsAny<Action<IEnumerable<Customer>>>()))
.Callback<IEnumerable<Customer>>(customers => SelectedCustomerData = customers);
Exception:
An exception of type 'System.NotSupportedException' occurred in Moq.dll but was not handled in user code
Additional information: Invalid setup on a non-virtual (overridable in VB) member: m => m.GetEvent().Subscribe(It.IsAny())