示例#1
0
        public async Task TestGetDataMethod()
        {
            ISwapiService mockService = new MockSwapiService();

            PeopleViewModel vm = new PeopleViewModel();

            vm.SetService(mockService);

            await vm.GetData();

            Assert.IsTrue(vm.HasNextPage);
        }
示例#2
0
        public async Task TestNextPageMethod()
        {
            ISwapiService mockService = new MockSwapiService();

            PeopleViewModel vm = new PeopleViewModel();

            vm.SetService(mockService);

            await vm.GetData();

            Assert.AreEqual("https://swapi.co/api/people/?format=json&page=2", vm.nextPage);
        }
示例#3
0
        public async Task TestGetDataCountMethod()
        {
            ISwapiService mockService = new MockSwapiService();

            PeopleViewModel vm = new PeopleViewModel();

            vm.SetService(mockService);

            await vm.GetData();

            Assert.AreEqual(20, vm.People.Count);
        }