예제 #1
0
        public void DeleteExistingDogShouldReturnNoContent()
        {
            var dogDto = new DogDto

            {
                Breed     = DogBreed.German_Shepherd,
                Name      = "Major",
                ImageData = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
            };

            _ = Controller.PostDog(dogDto, apiVersion);

            var result = Controller.DeleteDog(1, apiVersion);

            Assert.IsType <NoContentResult>(result);
        }
예제 #2
0
        public void DogControllerDeleteDogTest()
        {
            // Arrange
            var dogController = new DogsController();

            dogController.Clear();
            _dogTestCollection = new Dictionary <string, Dog>();
            PopulateTestCollection();

            var addDog1Result    = dogController.AddDog(_dogTestCollection["Bulldog"]);
            var addDog2Result    = dogController.AddDog(_dogTestCollection["Chihuahua"]);
            var deleteDog1Result = dogController.DeleteDog("Bulldog");
            var deleteDog2Result = dogController.DeleteDog("Chihuahua");
            var deleteDog3Result = dogController.DeleteDog("Sheepdog");
            var deleteEmptyDog   = dogController.DeleteDog("");

            // Assert
            Assert.AreEqual(typeof(OkResult), addDog1Result.GetType());
            Assert.AreEqual(typeof(OkResult), addDog2Result.GetType());
            Assert.AreEqual(typeof(OkResult), deleteDog1Result.GetType());
            Assert.AreEqual(typeof(OkResult), deleteDog2Result.GetType());
            Assert.AreEqual(typeof(BadRequestResult), deleteDog3Result.GetType());
            Assert.AreEqual(typeof(BadRequestResult), deleteEmptyDog.GetType());
        }