public void PrepareBrokerDataTest(string recommend) { var interactor = new InteractorPostHeader(string.Empty, _connection.Object, DataService.RepositoryController.RepositoryPost); DataModelQc brokerData = new DataModelQc(123, "123", "123", 123.123f, "123", 123.213f, 123.213f, 123.213f, 123.213f, "123", 123.213f, 123, 123); PostHeaderBrokerModel postHeaderBrokerModel = new PostHeaderBrokerModel(brokerData); IPostHeaderModel postHeaderModel = new DataModelPost("123", "123", "123", "123", recommend, 123.123f, "123", "123", "123", "123", "123", "123", "123", "123", 12, 123, true); interactor.Presenter = _presenterPostHeaderMock.Object; _presenterPostHeaderMock.Setup(f => f.GetPreviousPrice()).Returns(It.IsAny <double>()); _presenterPostHeaderMock.Setup(f => f.SetBrokerFields(postHeaderBrokerModel, interactor.GetCamelPos(postHeaderBrokerModel.CurrentPrice))); foreach (var item in typeof(InteractorPostHeader).GetRuntimeMethods()) { if (item.Name.Equals("PrepareBrokerData")) { item.Invoke(interactor, new object[] { postHeaderBrokerModel, postHeaderModel }); break; } } _presenterPostHeaderMock.Verify(f => f.GetPreviousPrice(), Times.AtLeastOnce); _presenterPostHeaderMock.Verify(f => f.SetBrokerFields(postHeaderBrokerModel, interactor.GetCamelPos(postHeaderBrokerModel.CurrentPrice)), Times.Once); }
public void Update(DataModelQc brokerData) { if (brokerData == null) { return; } Difference = brokerData.QcDiff; CurrentPriceBid = brokerData.QcBid; CurrentPriceAsk = brokerData.QcAsk; }
public PostHeaderBrokerModel(DataModelQc brokerData) { if (brokerData != null) { Difference = brokerData.QcDiff; CurrentPriceBid = brokerData.QcBid; CurrentPriceAsk = brokerData.QcAsk; } TickSize = 10; Rounding = 10000; }
public void SetBidAskPriceTest(string recommend, bool expected) { var interactor = new InteractorPostHeader(string.Empty, _connection.Object, DataService.RepositoryController.RepositoryPost); DataModelQc brokerData = new DataModelQc(123, "123", "123", 123.123f, "123", 123.213f, 123.213f, 123.213f, 123.213f, "123", 123.213f, 123, 123); PostHeaderBrokerModel postHeaderBrokerModel = new PostHeaderBrokerModel(brokerData); IPostHeaderModel postHeaderModel = new DataModelPost("123", "123", "123", "123", recommend, 123.123f, "123", "123", "123", "123", "123", "123", "123", "123", 12, 123, true); interactor.Presenter = _presenterPostHeaderMock.Object; foreach (var item in typeof(InteractorPostHeader).GetRuntimeMethods()) { if (item.Name.Equals("SetBidAskPrice")) { Enum.TryParse(postHeaderModel.Recommend, out EBuySell res); var actual = item.Invoke(interactor, new object[] { postHeaderBrokerModel, res }); Assert.AreEqual(expected, actual); break; } } }
public PostHeaderBrokerModelCreator(DataModelQc qcs) { _quotations = qcs ?? throw new ArgumentNullException(); }
public void SetUp() { _qc = new DataModelQc(1, "AUDCAD", "123.45", 123.45f, "123.45f", 123.45f, 123.45f, 123.45f, 123.45f, "Open", 123.45f, 123L, 123L); }