public async void DeleteCatch()
        {
            Response <List <FishType> > allFishTypes = await _fishingTripManager.GetAllFishTypes();

            _catch.FishType = allFishTypes.Content[0];
            Response <Catch> catchBeforeUpdate = await _fishingTripManager.CreateCatch(_catch);

            Assert.False(catchBeforeUpdate.Content.Length == 999);
            catchBeforeUpdate.Content.Length = 999;
            Response <FishingTrip> createdFishingTrip = await _fishingTripManager.CreateFishingTrip(_fishingTrip);

            Response <FishingTrip> addedCatchFishingTrip =
                await _fishingTripManager.AddCatch(createdFishingTrip.Content, catchBeforeUpdate.Content);

            Response <FishingTrip> fishingTripAfterUpdate =
                await _fishingTripManager.UpdateCatch(addedCatchFishingTrip.Content,
                                                      addedCatchFishingTrip.Content.Catches.Last());

            Assert.Equal(addedCatchFishingTrip.Content.Catches.Last().Id,
                         fishingTripAfterUpdate.Content.Catches.Last().Id);
            Assert.True(fishingTripAfterUpdate.Content.Catches.Last().Length == 999);
            Response <FishingTrip> deletedCatchResponse =
                await _fishingTripManager.DeleteCatch(fishingTripAfterUpdate.Content,
                                                      fishingTripAfterUpdate.Content.Catches.Last());

            Assert.True(deletedCatchResponse.Content.Catches.Count == 0);
        }
Exemple #2
0
        private async void Delete_Clicked(object sender, EventArgs e)
        {
            Catch _catch = (sender as MenuItem)?.CommandParameter as Catch;

            FishingTripManager     manager  = new FishingTripManager();
            Response <FishingTrip> response = await manager.DeleteCatch(FishingTrip, _catch);

            InformUserHelper <FishingTrip> informer =
                new InformUserHelper <FishingTrip>(response, this);

            informer.InformUserOfResponse();

            await ReloadFishingTrip();
        }