public PromotionList() { InitializeComponent(); //BindingContext = new PromotionListViewModel(Navigation); _vm = new PromotionListViewModel(Navigation, new DependencyServiceWrapper()); BindingContext = _vm; }
public void GetPromotionsCommandIsSuccessful() { var vm = new PromotionListViewModel(NavigationMock.Object, DependencyService); List <Promotion> list = new List <Promotion> { new Promotion { Id = Fixture.Create <int>(), Title = Fixture.Create <String>() } }; ServerSideDataMock.Setup(m => m.GetPromotions()).ReturnsAsync(list); vm.GetPromotionCommand.Execute(null); ServerSideDataMock.Verify(m => m.GetPromotions(), Times.Once()); Assert.IsNotNull(vm.PromotionList.Count); Assert.IsFalse(vm.IsBusy); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_promotion_list); _viewModel = App.Container.GetInstance <PromotionListViewModel>(); _refreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.SwipeRefreshLayout); _recyclerView = FindViewById <RecyclerView>(Resource.Id.StoreRecyclerView); _progressBar = FindViewById <ProgressBar>(Resource.Id.ProgressBar); _listAdapter = new PromotionListAdapter(_viewModel); _recyclerView.SetAdapter(_listAdapter); _recyclerView.SetLayoutManager(new LinearLayoutManager(this)); _viewModel.PropertyChanged += _viewModel_PropertyChanged; _refreshLayout.Refresh += _swipeRefreshLayout_Refresh; _viewModel.RefreshListCommand?.Execute(null); }
public PromotionListAdapter(PromotionListViewModel viewModel) { _viewModel = viewModel; }