public void PostSetBrokerFieldsDownPositiveTest() { _viewMock.Setup(f => f.SetDifference(It.IsAny <string>())); _viewMock.Setup(f => f.SetCurrentPrice(It.IsAny <string>(), It.IsAny <int>())); _viewMock.Setup(f => f.SetCurrentPriceImg(It.IsAny <IImageViewTheme>())); _viewMock.Setup(f => f.SetDifferenceValue(It.IsAny <ITextViewTheme>())); _postLocaleStrings.SetupGet(f => f.Pips).Returns(It.IsAny <string>()); _stylesHolderMock.SetupGet(f => f.CurrentPriceImgDown).Returns(It.IsAny <IImageViewTheme>()); _stylesHolderMock.SetupGet(f => f.DifferenceValuePositive).Returns(It.IsAny <ITextViewTheme>()); _interactorMock.Setup(f => f.GetRepository().LangPost.OptionsHeader).Returns(It.IsAny <Func <string, string, string> >()); var presenter = new PresenterPostHeader(_viewMock.Object, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); _postHeaderBrokerModel.IsCurrentPriceIncreasing = false; _postHeaderBrokerModel.IsDifferencePositive = true; presenter.SetBrokerFields(_postHeaderBrokerModel, It.IsAny <int>()); _viewMock.Verify(f => f.SetDifference(It.IsAny <string>()), Times.Once); _viewMock.Verify(f => f.SetCurrentPrice(It.IsAny <string>(), It.IsAny <int>()), Times.Once); _viewMock.Verify(f => f.SetCurrentPriceImg(It.IsAny <IImageViewTheme>()), Times.Once); _viewMock.Verify(f => f.SetDifferenceValue(It.IsAny <ITextViewTheme>()), Times.Once); _stylesHolderMock.VerifyGet(f => f.CurrentPriceImgDown, Times.Once); _stylesHolderMock.VerifyGet(f => f.DifferenceValuePositive, Times.Once); }
public void PresenterInitNullThemeStringsTest() { Assert.Throws(typeof(ArgumentNullException), () => { var presenter = new PresenterPostHeader(null, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); }); }
public void GetRepositoryTest() { _interactorMock.Setup(f => f.GetRepository()).Returns(It.IsAny <IRepositoryPost>()); var presenter = new PresenterPostHeader(_viewMock.Object, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); presenter.GetRepository(); _interactorMock.Verify(f => f.GetRepository(), Times.Once); }
public void PostConfirmDeleteClickTest() { _interactorMock.Setup(f => f.DeletePostClick()); var presenter = new PresenterPostHeader(_viewMock.Object, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); presenter.ConfirmDeleteClick(); _interactorMock.Verify(f => f.DeletePostClick(), Times.Once); }
public void PostProfileClickTest() { _routerMock.Setup(f => f.ToProfile()); var presenter = new PresenterPostHeader(_viewMock.Object, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); presenter.ProfileClick(); _routerMock.Verify(f => f.ToProfile(), Times.Once); }
public void PostSetFavoriteStateNoneTest() { _viewMock.Setup(f => f.SetFavoriteState(false, It.IsAny <IImageButtonTheme>())); _stylesHolderMock.SetupGet(f => f.FavoriteStateNone).Returns(It.IsAny <IImageButtonTheme>()); var presenter = new PresenterPostHeader(_viewMock.Object, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); presenter.SetQuoteFavoriteState(false); _viewMock.Verify(f => f.SetFavoriteState(false, It.IsAny <IImageButtonTheme>()), Times.Once); _stylesHolderMock.VerifyGet(f => f.FavoriteStateNone, Times.Once); }
public void PostOptionsClickTest() { _viewMock.Setup(f => f.OptionsDialogShow(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())); _postLocaleStrings.SetupGet(f => f.OptionsHeader).Returns(It.IsAny <string>()); _postLocaleStrings.SetupGet(f => f.DeletePost).Returns(It.IsAny <string>()); _postLocaleStrings.SetupGet(f => f.Edit).Returns(It.IsAny <string>()); _interactorMock.Setup(f => f.GetRepository().LangPost.OptionsHeader).Returns(It.IsAny <Func <string, string, string> >()); var presenter = new PresenterPostHeader(_viewMock.Object, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); presenter.OptionsClick(); _viewMock.Verify(f => f.OptionsDialogShow(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once); }
public void PostFavoriteActiveClickTest() { _interactorMock.Setup(f => f.FavoriteClick()); _viewMock.Setup(f => f.SetFavoriteState(true, It.IsAny <IImageButtonTheme>())); _stylesHolderMock.SetupGet(f => f.FavoriteStateActive).Returns(It.IsAny <IImageButtonTheme>()); var presenter = new PresenterPostHeader(_viewMock.Object, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); presenter.FavoriteClick(true); _interactorMock.Verify(f => f.FavoriteClick(), Times.Once); _viewMock.Verify(f => f.SetFavoriteState(true, It.IsAny <IImageButtonTheme>()), Times.Once); _stylesHolderMock.VerifyGet(f => f.FavoriteStateActive, Times.Once); }
public void PostDeleteClickTest() { _viewMock.Setup(f => f.ShowDeletingDialog(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())); _postLocaleStrings.SetupGet(f => f.DeletePostMessage).Returns(It.IsAny <string>()); _postLocaleStrings.SetupGet(f => f.DeletePostTitle).Returns(It.IsAny <string>()); _postLocaleStrings.SetupGet(f => f.Yes).Returns(It.IsAny <string>()); _postLocaleStrings.SetupGet(f => f.No).Returns(It.IsAny <string>()); _interactorMock.Setup(f => f.GetRepository().LangPost.DeletePostMessage).Returns(It.IsAny <Func <string, string> >()); var presenter = new PresenterPostHeader(_viewMock.Object, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); presenter.DeleteClick(); _viewMock.Verify(f => f.ShowDeletingDialog(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once); }
public void PostSetHeaderWithoutAvatarTest() { _viewMock.Setup(f => f.SetName(It.IsAny <string>())); _viewMock.Setup(f => f.SetAvatar(It.IsAny <string>())); _interactorMock.Setup(f => f.UpdateCreatedTime(It.IsAny <DateTime>())); _stylesHolderMock.SetupGet(f => f.FavoriteStateNone).Returns(It.IsAny <IImageButtonTheme>()); var presenter = new PresenterPostHeader(_viewMock.Object, _interactorMock.Object, _routerMock.Object, _postLocaleStrings.Object, _stylesHolderMock.Object); _postHeaderModel.CreatedAt = "123"; presenter.SetUserHeader(_postHeaderModel); _viewMock.Verify(f => f.SetName(It.IsAny <string>()), Times.Once); _viewMock.Verify(f => f.SetAvatar(It.IsAny <string>()), Times.Never); _interactorMock.Verify(f => f.UpdateCreatedTime(It.IsAny <DateTime>()), Times.Once); }
public PresenterPost(IViewPost view, IInteractorPost interactor, IRouterPost router, PostOtherThemeStrings otherThemeStrings, IPostHeaderStylesHolder headerStylesHolder, IPostSocialStylesHolder socialStylesHolder, IPostBodyStylesHolder bodyStylesHolder, IPost postLocale, bool isPostDetailed) { _view = view; _router = router; _interactor = interactor; _postLocale = postLocale; _isPostDetailed = isPostDetailed; _otherThemeStrings = otherThemeStrings; IPresenterPostHeader presenterPostHeader = new PresenterPostHeader(view.ViewPostHeader, interactor.InteractorPostHeader, router, DataService.RepositoryController.RepositoryPost.LangPost, headerStylesHolder); IPresenterPostBody presenterPostBody = new PresenterPostBody(view.ViewPostBody, interactor.InteractorPostBody, router, bodyStylesHolder, isPostDetailed); IPresenterPostSocial presenterPostSocial = new PresenterPostSocial(view.ViewPostSocial, interactor.InteractorPostSocial, router, DataService.RepositoryController.RepositoryPost.LangPost, socialStylesHolder); interactor.InteractorPostBody.Presenter = presenterPostBody; interactor.InteractorPostHeader.Presenter = presenterPostHeader; interactor.InteractorPostSocial.Presenter = presenterPostSocial; _view.SetConfig(); presenterPostHeader.SetConfig(); presenterPostSocial.SetConfig(); }