Exemplo n.º 1
0
        public void GetPromotionsCommandIsNotSuccessful()
        {
            // Arrange
            var vm = new PromotionsListViewModel(NavigationMock.Object, DependencyService);
            List <Promotion> list = new List <Promotion>();

            ServerSideDataMock.Setup(m => m.GetPromotions()).ReturnsAsync(list);

            // Act
            vm.GetPromotionsCommand.Execute(null);

            // Assert
            ServerSideDataMock.Verify(m => m.GetPromotions(), Times.Once());
            Assert.IsNull(vm.PromotionsList);
            Assert.IsFalse(vm.IsBusy);
        }
Exemplo n.º 2
0
        public void GetPromotionsCommandIsSuccessful()
        {
            // Arrange
            var vm = new PromotionsListViewModel(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);

            // Act
            vm.GetPromotionsCommand.Execute(null);

            // Assert
            ServerSideDataMock.Verify(m => m.GetPromotions(), Times.Once());
            Assert.IsNotNull(vm.PromotionsList);
            Assert.AreEqual(1, vm.PromotionsList.Count);
            Assert.IsFalse(vm.IsBusy);
        }
Exemplo n.º 3
0
 public PromotionsList()
 {
     InitializeComponent();
     _vm            = new PromotionsListViewModel(Navigation, new DependencyServiceWrapper());
     BindingContext = _vm;
 }