public void Initialize() { var context = new Mock<IContextAware>(); var view = new Mock<INotificationView>(); { view.SetupSet(v => v.Model = It.IsAny<NotificationModel>()) .Verifiable(); } var parameter = new NotificationParameter(context.Object); var container = new Mock<IDependencyInjectionProxy>(); { container.Setup(c => c.Resolve<IContextAware>()) .Returns(context.Object); container.Setup(c => c.Resolve<ICollectNotifications>()) .Returns(new Mock<ICollectNotifications>().Object); } var presenter = new NotificationPresenter(container.Object); ((IPresenter)presenter).Initialize(view.Object, parameter); Assert.AreSame(view.Object, presenter.View); Assert.AreSame(parameter, presenter.Parameter); view.VerifySet(v => v.Model = It.IsAny<NotificationModel>(), Times.Once()); }
void Page_Loaded(object sender, RoutedEventArgs e) { Storyboard fadeInStoryBoard = (Storyboard)FindName("FadeInStoryBoard"); fadeInStoryBoard.Begin(); _notificationPresenter = new NotificationPresenter(NotificationControl); _notificationPresenter.ShowNotification("Loaded Okay!"); _loadingPresenter = new LoadingPresenter(LoadingControl); _optionsPresenter = new OptionsPresenter(OptionsControl); _optionsPresenter.ClearBookWeb += new EventHandler(_optionsPresenter_ClearBookWeb); _optionsPresenter.Help += new EventHandler(_optionsPresenter_Help); _optionsPresenter.TextBookSearch += new EventHandler(_optionsPresenter_TextBookSearch); _bookDetailPresenter = new BookDetailPresenter(DetailControl); _bookDetailPresenter.Hidden += new Tarantula.MVP.Events.BookEventHandler(_bookDetailPresenter_Hidden); _helpPresenter = new HelpPresenter(new HelpControl()); _textSearchPresenter = new TextSearchPresenter(new TextSearchControl()); _textSearchPresenter.StartSearch += new Tarantula.MVP.Events.TextSearchEventHandler(_textSearchPresenter_StartSearch); _bookWebPresenter= new BookWebPresenter(bookWebControl); _bookWebPresenter.OnLoadingBooks += new EventHandler(_bookWebPresenter_OnLoadingBooks); _bookWebPresenter.OnFinishedLoadingBooks += new EventHandler(_bookWebPresenter_OnFinishedLoadingBooks); _bookWebPresenter.OnLoadingBooksError += new Tarantula.MVP.Events.BookWebNotificationHandler(_bookWebPresenter_OnLoadingBooksError); _bookWebPresenter.ShowBookDetails += new Tarantula.MVP.Events.BookEventHandler(_bookWebPresenter_ShowBookDetails); _bookWebPresenter.SearchResultsSummary += new Tarantula.MVP.Events.BookWebNotificationHandler(_bookWebPresenter_SearchResultsSummary); }
protected override void Context() { _view = A.Fake <INotificationView>(); _buildingBlock = A.Fake <IBuildingBlock>(); _region = A.Fake <IRegion>(); _userSettings = A.Fake <IUserSettings>(); _viewItemContextMenuFactory = A.Fake <IViewItemContextMenuFactory>(); _userSettings.VisibleNotification = _settingsToUse; _regionResolver = A.Fake <IRegionResolver>(); _buildingBlockRetriever = A.Fake <IBuildingBlockRetriever>(); _applicationController = A.Fake <IMoBiApplicationController>(); _context = A.Fake <IMoBiContext>(); _dialogCreator = A.Fake <IDialogCreator>(); _notificationMessageMapper = new NotificationMessageMapper(new ObjectTypeResolver(), _buildingBlockRetriever); A.CallTo(() => _regionResolver.RegionWithName(RegionNames.NotificationList)).Returns(_region); sut = new NotificationPresenter(_view, _regionResolver, _userSettings, _notificationMessageMapper, _viewItemContextMenuFactory, _applicationController, _context, _dialogCreator); A.CallTo(() => _view.BindTo(A <NotifyList <NotificationMessageDTO> > ._)) .Invokes(x => _allNotifications = x.GetArgument <IEnumerable <NotificationMessageDTO> >(0)); sut.Initialize(); }