private static List <CelestialObjectModel> GetList()
 {
     return(new List <CelestialObjectModel>
     {
         CelestialObjectSeedHelper.GetSun()
     });
 }
        public void HttpDataLoaderCelestialObjectReadTest()
        {
            var planetResult = CelestialObjectSeedHelper.GetPlanets();
            var emptyResult  = new List <CelestialObjectModel>();

            var connector = new Mock <IConnector <CelestialObjectModel> >();

            connector.Setup(x => x.ReadAsync(It.Is <FilterModel>(f => f.Sort.Skip <= 0))).Returns(
                Task.Run(() => planetResult));

            connector.Setup(x => x.ReadAsync(It.Is <FilterModel>(f => f.Sort.Skip > 0))).Returns(
                Task.Run(() => emptyResult));

            var collectionFetchedCount = 0;
            var endOfCollectionCount   = 0;

            var dataLoader = new CelestialObjectDataLoader(connector.Object);

            dataLoader.CollectionFetchedEvent += (sender, args) => { collectionFetchedCount++; };
            dataLoader.EndOfCollectionEvent   += (sender, args) => { endOfCollectionCount++; };

            Task.Run(() => dataLoader.LoadAsync(DataLoading.Refresh, CelestialObjectSeedHelper.GetSun())).ContinueWith(t =>
            {
                Assert.Equal(1, collectionFetchedCount);
                Assert.Equal(1, endOfCollectionCount);
            });
        }
Exemplo n.º 3
0
        public App()
        {
            StartupHelper.Initialize();

            DataConnectionHelper.InitDataConnection();

            InitializeComponent();

            Task.Run(GeoLocationHelper.SetGeoLocation).ConfigureAwait(false);

            var mainpage = new MainPageModel(CelestialObjectSeedHelper.GetSun());

            mainpage.SetModel(null);

            MainPage = mainpage;
        }
Exemplo n.º 4
0
 internal static string GetCelestialObjectPlanetContentString()
 {
     return JsonConvert.SerializeObject(CelestialObjectSeedHelper.GetPlanets());
 }
 protected override List <CelestialObjectModel> SeedList(Expression <Func <CelestialObjectModel, bool> > batchExpression)
 {
     return(CelestialObjectSeedHelper.GetPlanets().Where(batchExpression.Compile()).ToList());
 }
Exemplo n.º 6
0
 protected override Task <List <CelestialObjectViewModel> > GetData(CelestialObjectModel model)
 {
     return(Task.Run(() => CelestialObjectSeedHelper.GetPlanets().Select(x => new CelestialObjectViewModel(x)).ToList()));
 }