예제 #1
0
 public void SetHeader(IPostHeaderModel model, int position)
 {
     if (!string.IsNullOrEmpty(model.Quote) && !string.IsNullOrEmpty(model.Price) && !string.IsNullOrEmpty(model.Recommend) &&
         !string.IsNullOrEmpty(model.Forecast) && !string.IsNullOrEmpty(model.CreatedAt))
     {
         _view.SetQuote(model.Quote);
         _view.SetRecommendValue(model.Price, position);
         SetRecommend(model.Recommend);
         SetQuoteFavoriteState(model.IsQuoteFavorite);
     }
 }
예제 #2
0
        public void SetUserHeader(IPostHeaderModel model)
        {
            if (!string.IsNullOrWhiteSpace(model.AuthorAvatar)) // TODO
            {
                _view.SetAvatar(model.AuthorAvatar);
            }

            _view.SetName(model.AuthorName);
            _interactor.UpdateCreatedTime(model.CreatedAtDateTime);
            //SetStatusUser(model.StatusUser);
        }
예제 #3
0
 public void RecieveModel(DataModelPost data)
 {
     if (data is IPostHeaderModel userModel)
     {
         _postHeaderModel = userModel;
         _forecastDate    = userModel.ForecastDateTime;
         PepareHeaderData(userModel);
     }
     if (_brokerDataModel == null)
     {
         _postHeaderController.GetQc();
     }
 }
예제 #4
0
        private void PrepareBrokerData(PostHeaderBrokerModel postHeaderBrokerModel, IPostHeaderModel postHeaderModel)
        {
            if (postHeaderModel == null || postHeaderBrokerModel == null)
            {
                return;
            }
            Enum.TryParse(postHeaderModel.Recommend, out EBuySell recommend);

            if (recommend != EBuySell.Buy && recommend != EBuySell.Sell)
            {
                return;
            }

            bool isSell = SetBidAskPrice(postHeaderBrokerModel, recommend);

            int camelPositionCurrentPrice = GetCamelPos(postHeaderBrokerModel.CurrentPrice);

            postHeaderModel.Price = AlignRorPrice(postHeaderBrokerModel.CurrentPrice, postHeaderModel.Price);
            int camelPositionPrice = GetCamelPos(postHeaderModel.Price);

            var prevPrice          = Presenter.GetPreviousPrice();
            var doubleCurrentPrice = double.Parse(postHeaderBrokerModel.CurrentPrice, CultureInfo.InvariantCulture);

            postHeaderBrokerModel.IsCurrentPriceIncreasing = SetPriceStatus(prevPrice, doubleCurrentPrice);

            try
            {
                postHeaderBrokerModel.IsCurrentPriceIncreasing = SetPriceStatus(Presenter.GetPreviousPrice(), Convert.ToDouble(postHeaderBrokerModel.CurrentPrice));
            }
            catch (Exception)
            {
                return;
            }

            try
            {
                var difference = SetDifferenceAmmount(postHeaderModel.Price, postHeaderBrokerModel.CurrentPrice, isSell,
                                                      camelPositionPrice, camelPositionCurrentPrice);

                postHeaderBrokerModel.IsDifferencePositive = difference > 0;
                postHeaderBrokerModel.Difference           = difference;
            }
            catch (Exception)
            {
                return;
            }

            Presenter.SetBrokerFields(postHeaderBrokerModel, camelPositionCurrentPrice);
        }
예제 #5
0
        private void PepareHeaderData(IPostHeaderModel postHeaderModel)
        {
            Presenter.SetOptionsButtonVisibility(postHeaderModel.IsMyPost);


            if (postHeaderModel.Market == EMarketTypes.Simple.ToString())
            {
                Presenter.SetUserHeader(postHeaderModel);
            }
            else
            {
                Presenter.SetHeader(postHeaderModel, GetCamelPos(postHeaderModel.Price));
                Presenter.SetUserHeader(postHeaderModel);
            }
        }
예제 #6
0
        public void SetUp()
        {
            _routerMock      = new Mock <IRouterPostHeader>(MockBehavior.Strict);
            _viewMock        = new Mock <IViewPostHeader>(MockBehavior.Strict);
            _interactorMock  = new Mock <IInteractorPostHeader>(MockBehavior.Strict);
            _postHeaderModel = new DataModelPost(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(),
                                                 It.IsAny <float>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(),
                                                 It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <bool>());

            _postHeaderBrokerModel = new PostHeaderBrokerModel();

            _viewMock.SetupSet(f => f.Presenter = It.IsAny <IPresenterPostHeader>());
            _viewMock.Setup(f => f.SetConfig());

            _interactorMock.SetupSet(f => f.Presenter = It.IsAny <IPresenterPostHeader>());

            _postLocaleStrings = new Mock <IPost>(MockBehavior.Strict);
            _stylesHolderMock  = new Mock <IPostHeaderStylesHolder>(MockBehavior.Strict);
        }
예제 #7
0
 public HeaderUserModelCreator(IPostHeaderModel userInfo)
 {
     _userInfo = userInfo ?? throw new ArgumentNullException();
 }