Exemplo n.º 1
0
 public void SetUp()
 {
     _navigator          = Substitute.For <NavigatorGateway>();
     _categoryRepository = Substitute.For <CategoryRepository>();
     SetUpPurchaseItemAction();
     SetUpView();
     SetUpGetItemsAction();
     _ = new CustomizationPresenter(_view, _navigator, _categoryRepository, _getItems, _purchaseItem);
 }
Exemplo n.º 2
0
        public CustomizationPresenter(
            CustomizationView view,
            NavigatorGateway navigator,
            CategoryRepository categoryRepository,
            GetItems getItems,
            PurchaseItem purchaseItem)
        {
            _view               = view;
            _navigator          = navigator;
            _categoryRepository = categoryRepository;
            _getItems           = getItems;
            _purchaseItem       = purchaseItem;

            _view.OnEnabled.Subscribe(DisplayCategories);
            _view.CategorySelected.Subscribe(OnCategorySelected);

            _view.ItemSelected
            .Where(IsItemUnlocked)
            .SelectMany(AskPurchaseIfNotPurchased)
            .Do(OnSelectItem)
            .Subscribe();

            _view.OnComplete.Subscribe(GoToNextStep);
        }