public async Task <ServiceResponse> DeleteLostDog(int dogId)
        {
            var repoResponse = await lostDogDataRepository.DeleteLostDog(dogId);

            var serviceResponse = mapper.Map <ServiceResponse>(repoResponse);

            if (!serviceResponse.Successful)
            {
                serviceResponse.StatusCode = StatusCodes.Status400BadRequest;
            }
            return(serviceResponse);
        }
Пример #2
0
        public async void DeletingLostDogClearsAllData()
        {
            var saveDog = new LostDog()
            {
                Breed       = "dogdog",
                Age         = 5,
                Size        = "Large, very large",
                Color       = "Orange but a bit yellow and green dots",
                SpecialMark = "tattoo of you on the neck",
                Name        = "Cat",
                Picture     = new PictureDog()
                {
                    FileName = "photo",
                    FileType = "png",
                    Data     = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
                },
                HairLength = "Long",
                EarsType   = "Short",
                TailLength = "None",
                Behaviors  = new List <DogBehavior>()
                {
                    new DogBehavior()
                    {
                        Behavior = "Angry"
                    }
                },
                Location = new LocationDog()
                {
                    City = "Biała", District = "Lol ther's none"
                },
                DateLost = new DateTime(2021, 3, 20),
                OwnerId  = 1,
                Comments = new List <LostDogComment>()
            };

            var dog = await lostDogRepository.AddLostDog(saveDog);

            Assert.True(dog.Successful);

            var result = await lostDogRepository.DeleteLostDog(dog.Data.Id);

            Assert.True(result.Successful);

            dog = await lostDogRepository.GetLostDogDetails(dog.Data.Id);

            Assert.False(dog.Successful);
        }