예제 #1
0
        public void PresenterAddsFundOnEvent()
        {
            var view = new MockActivityView();
            var mockEventAggregator = new MockEventAggregator();

            MockFundAddedEvent mockEvent = new MockFundAddedEvent();

            mockEventAggregator.AddMapping <FundAddedEvent>(mockEvent);

            ActivityPresenter presenter = new ActivityPresenter(mockEventAggregator);

            presenter.View = view;
            string customerId = "ALFKI";

            presenter.CustomerId = customerId;
            FundOrder payload = new FundOrder()
            {
                CustomerId = customerId, TickerSymbol = "MSFT"
            };

            mockEvent.Subscribe(delegate { new FundOrder()
                                           {
                                               CustomerId = customerId, TickerSymbol = "MSFT"
                                           }; }, ThreadOption.UIThread, true, delegate { return(true); });
            mockEvent.Publish(payload);
            StringAssert.Contains(view.AddContentArgumentContent, "MSFT");
        }
        public void PresenterAddsFundOnEvent()
        {
            var view = new MockActivityView();
            var mockEventAggregator = new MockEventAggregator();

            MockFundAddedEvent mockEvent = new MockFundAddedEvent();
            mockEventAggregator.AddMapping<FundAddedEvent>(mockEvent);

            ActivityPresenter presenter = new ActivityPresenter(mockEventAggregator);
            presenter.View = view;
            string customerId = "ALFKI";
            presenter.CustomerId = customerId;
            FundOrder payload = new FundOrder() { CustomerId = customerId, TickerSymbol = "MSFT" };
            mockEvent.SubscribeArgumentAction(payload);
            StringAssert.Contains(view.AddContentArgumentContent, "MSFT");
        }