public NavigationViewModelTests() { _friendSavedEvent = new FriendSavedEvent(); var eventAggregatorMock = new Mock <IEventAggregator>(); eventAggregatorMock.Setup(ea => ea.GetEvent <FriendSavedEvent>()) .Returns(_friendSavedEvent); var navigationDataProviderMock = new Mock <INavigationDataProvider>(); navigationDataProviderMock.Setup(dp => dp.GetAllFriends()) .Returns(new List <LookupItem> { new LookupItem { Id = 1, DisplayMember = "Julia" }, new LookupItem { Id = 2, DisplayMember = "Thomas" } }); _viewModel = new NavigationViewModel( navigationDataProviderMock.Object, eventAggregatorMock.Object); }
public NavigationViewModelTests() //ctor for test methds { _friendSavedEvent = new FriendSavedEvent(); _friendDeletedEvent = new FriendDeletedEvent(); var eventAggregatorMock = new Mock <IEventAggregator>(); eventAggregatorMock.Setup(ea => ea.GetEvent <FriendSavedEvent>()) .Returns(_friendSavedEvent); eventAggregatorMock.Setup(ea => ea.GetEvent <FriendDeletedEvent>()) .Returns(_friendDeletedEvent); var navigationDataProviderMock = new Mock <INavigationDataProvider>(); //przy uzyciu Moq, zamiast klasy z końca pliku navigationDataProviderMock.Setup(dp => dp.GetAllFriends()) .Returns(new List <LookupItem> { new LookupItem { Id = 1, DisplayMember = "Pszemek" }, new LookupItem { Id = 2, DisplayMember = "Alicja" } }); _viewModel = new NavigationViewModel(navigationDataProviderMock.Object, eventAggregatorMock.Object); //instancja makiety }
public NavigationViewModelTests() { _friendSavedEvent = new FriendSavedEvent(); _friendDeletedEvent = new FriendDeletedEvent(); var eventAggregatorMock = new Mock <IEventAggregator>(); eventAggregatorMock.Setup(ea => ea.GetEvent <FriendSavedEvent>()) .Returns(_friendSavedEvent); eventAggregatorMock.Setup(ea => ea.GetEvent <FriendDeletedEvent>()) .Returns(_friendDeletedEvent); _viewModel = new NavigationViewModel(ConstructNavigationDataProviderMock(), eventAggregatorMock.Object); }