Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }