I have a class that uses constructor DI for IEventAggregator
public SomeViewModel(IEventAggregator eventAggregator)
{
this.eventAggregator = eventAggregator;
eventAggregator.GetEvent<SomethingChanged>().Subscribe(UpdateResults);
}
I have another method in the same class that executes some logic that is not using eventAggregator
.
public void SomeMethod()
{
//Necessary logic
}
Now I need to create a unit test for this method. I have a different test project of type class library.
I created a mock object using Moq
var someObject = new SomeViewModel(new Mock<IEventAggregator>())
someObject.SomeMethod();
This requires adding the prism reference to my Test Project. Is this the right way? or can I create an object for SomeViewModel without using Moq and IEventAggregator?