Пример #1
0
        /// <summary>
        /// Updates the dog.
        /// </summary>
        /// <param name="dog">The dog.</param>
        /// <returns>The dog</returns>
        public ResponseItem<Dog> UpdateDog(Dog dog)
        {
            var adapter = new DogAdapterStub();
            var newDog = adapter.UpdateDog(dog);

            var result = (newDog != null) ? ResultCodeEnum.Success : ResultCodeEnum.NotFound;

            return new ResponseItem<Dog>(result)
            {
                Data = newDog
            };
        }
Пример #2
0
        public void UpdateDogsTest()
        {
            const string petName = "Roxy Dog";
            var adapter = new DogAdapterStub();
            
            var dog = adapter.GetAllDogs().First();
            dog.Name = petName;

            adapter.UpdateDog(dog);
            
            var updatedDog = adapter.GetDogById(dog.Id);

            Assert.AreEqual(petName, updatedDog.Name);
        }