public void DeletePet_GivenExistentId_DeleteThePet()
        {
            _petApi.DeletePet(PetId);

            var exception = Assert.Throws <ApiException>(() => _petApi.GetPetById(PetId));

            Assert.IsType <ApiException>(exception);
            Assert.Equal(404, exception.ErrorCode);
        }
        public void Cleanup()
        {
            // remove the pet after testing
            PetApi petApi = new PetApi();

            petApi.DeletePet(petId, "test key");
        }
Пример #3
0
        public void DeletePetTest()
        {
            // TODO: add unit test for the method 'DeletePet'
            long?  petId  = null; // TODO: replace null with proper value
            string apiKey = null; // TODO: replace null with proper value

            instance.DeletePet(petId, apiKey);
        }
        public PetApiTestsV2()
        {
            // prepare the client
            _petApi = new PetApi(_httpClient, new Configuration
            {
                BasePath  = BasePath,
                Timeout   = 10000,
                UserAgent = "TEST_USER_AGENT"
            });

            // add a sample pet for the expected PetId
            _petApi.AddPet(BuildSamplePet());

            // ensure there is not a pet for that ID
            try
            {
                _petApi.DeletePet(NotExistentId);
            }
            catch (ApiException ex) when(ex.ErrorCode == 404)
            {
            }
        }