Beispiel #1
0
        public void TestSimpleDataServiceGetSingleWaterModelWithID()
        {
            Guid idNotExists = Guid.NewGuid();
            Guid idExists    = Guid.Parse("2a3eeecf-472c-4b0f-9df0-73386cb3b3f7");

            SimpleDataService <WaterModel> simpleService = new SimpleDataService <WaterModel>(_connection, "WaterModels");

            WaterModel result = simpleService.GetItemAsync(idNotExists).Result;

            Assert.Null(result);

            result = simpleService.GetItemAsync(idExists).Result;

            Assert.NotNull(result);

            Assert.True(result.Id == idExists);
        }
Beispiel #2
0
        public void GetSpot()
        {
            DataServiceFactory.Connection = _connection;

            SimpleDataService <SpotModel> factory = DataServiceFactory.GetSpotFactory();

            Assert.NotNull(factory);

            Guid spotId = Guid.Parse("610b3ec0-0d70-40a6-9d9f-5167a8135410");

            SpotModel existingSpot = factory.GetItemAsync(spotId).Result;

            Assert.True(existingSpot.SpotMarker.Count > 0);
        }
Beispiel #3
0
        public void SaveExistingFishingArea()
        {
            DataServiceFactory.Connection = _connection;

            SimpleDataService <FishingAreaModel> factory = DataServiceFactory.GetFishingAreaFactory();

            Assert.NotNull(factory);

            Guid areaId = Guid.Parse("0c46a2fd-9a56-4663-9ead-0d92ff39db7c");

            FishingAreaModel existingArea = factory.GetItemAsync(areaId).Result;

            Assert.NotNull(existingArea);

            FishingAreaModel success = factory.SaveItemAsync(existingArea).Result;

            Assert.True(success.Id != Guid.Empty);
        }
Beispiel #4
0
        public void SaveFishingArea()
        {
            DataServiceFactory.Connection = _connection;

            SimpleDataService <FishingAreaModel> factory = DataServiceFactory.GetFishingAreaFactory();

            Assert.NotNull(factory);

            Guid areaId = Guid.NewGuid();

            FishingAreaModel tstFishingArea = new FishingAreaModel();

            tstFishingArea.Id            = areaId;
            tstFishingArea.ID_WaterModel = Guid.Parse("2a3eeecf-472c-4b0f-9df0-73386cb3b3f7");
            tstFishingArea.Lat           = 48.46;
            tstFishingArea.Lng           = 13.9267;
            tstFishingArea.FishingArea   = "Donau Obermühl";
            tstFishingArea.IsNew         = true;

            FishingAreaModel success = factory.SaveItemAsync(tstFishingArea).Result;

            Assert.True(success.Id != Guid.Empty);

            FishingAreaModel storedFishingArea = factory.GetItemAsync(areaId).Result;

            Assert.True(storedFishingArea.Id == areaId);


            Guid      spotId  = Guid.NewGuid();
            SpotModel newSpot = new SpotModel();

            newSpot.FishingArea    = storedFishingArea;
            newSpot.Id             = spotId;
            newSpot.Spot           = "Zanderfelsen";
            newSpot.ID_FishingArea = storedFishingArea.Id;
            newSpot.ID_SpotType    = Guid.Parse("1fb8243b-a672-496b-955a-5930cb706250");
            newSpot.IsNew          = true;

            storedFishingArea.Spots.Add(newSpot);

            success = factory.SaveItemAsync(storedFishingArea).Result;

            Assert.True(success.Id != Guid.Empty);
        }
 async static Task <BackgroundTaskModel> GetElementById(Guid id)
 {
     Service = new SimpleDataService <BackgroundTaskModel>(Connection, TableConsts.BACKGROUND_TASK_TABLE);
     return(await Service.GetItemAsync(id));
 }