Example #1
0
        public void UpdateAnimalStoryWrongEnclosureId()
        {
            var ans = new AnimalStory
            {
                id          = default(int),
                pictureUrl  = "pictureUrl1",
                enclosureId = -2,
            };

            context.UpdateAnimalStory(ans);
        }
Example #2
0
        public void UpdateAnimalStoryAddAnValidTest()
        {
            var animalStory = context.GetAllAnimalStories();

            Assert.AreEqual(2, animalStory.Count());

            var ans = new AnimalStory
            {
                id          = default(int),
                enclosureId = 2,
                pictureUrl  = "storyUrl1000"
            };

            context.UpdateAnimalStory(ans);

            animalStory = context.GetAllAnimalStories();
            Assert.AreEqual(3, animalStory.Count());
        }
Example #3
0
        public AnimalStory UpdateAnimalStory(AnimalStory animalStory)
        {
            try
            {
                using (var db = GetContext())
                {
                    if (!ValidateSessionId(db))
                    {
                        throw new AuthenticationException("Couldn't validate the session");
                    }

                    return(db.UpdateAnimalStory(animalStory));
                }
            }
            catch (Exception Exp)
            {
                var animalStoryInput = "Id: " + animalStory.id + ", enclosure Id: " + animalStory.enclosureId +
                                       ", picture Url: " + animalStory.pictureUrl;
                Logger.GetInstance(isTesting).WriteLine(Exp.Message, Exp.StackTrace, animalStoryInput);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
        }