예제 #1
0
        public void UpdateAnimalStoryDetailsWrongStory()
        {
            var ansd = new AnimalStoryDetail
            {
                animalStoryId = 1,
                language      = (int)Languages.he,
                name          = "שם"
            };

            context.UpdateAnimalStoryDetail(ansd);
        }
예제 #2
0
        public void UpdateAnimalStoryDetailsWrongLangauge()
        {
            var ansd = new AnimalStoryDetail
            {
                animalStoryId = 1,
                language      = -100,
                name          = "גילי הבבון",
                story         = "לגילי הבבון סיפור מיוחד ומרגש"
            };

            context.UpdateAnimalStoryDetail(ansd);
        }
예제 #3
0
        public void UpdateAnimalStoryDetailsNameExists()
        {
            var ansd = new AnimalStoryDetail
            {
                animalStoryId = 1,
                language      = (int)Languages.en,
                name          = "Shosh the Zebra",
                story         = "Gili the baboon have a very speacial story"
            };

            context.UpdateAnimalStoryDetail(ansd);
        }
예제 #4
0
        public void UpdateAnimalStoryDetailsAddAnimalNameExists()
        {
            var ansd = new AnimalStoryDetail
            {
                animalStoryId = default(int),
                name          = "גילי בבון הזית",
                story         = "סיפור",
                language      = (int)Languages.he
            };

            context.UpdateAnimalStoryDetail(ansd);
        }
예제 #5
0
        public void UpdateAnimalStoryDetailsAddAnimalStoryDoesntExists()
        {
            var ansd = new AnimalStoryDetail
            {
                animalStoryId = -1,
                name          = "שם",
                story         = "סיפור",
                language      = (int)Languages.ar
            };

            context.UpdateAnimalStoryDetail(ansd);
        }
예제 #6
0
        public void UpdateAnimalStoryDetailsWrongName()
        {
            var ansd = new AnimalStoryDetail
            {
                animalStoryId = 1,
                language      = (int)Languages.he,
                name          = "    ",
                story         = "לגילי הבבון סיפור מיוחד ומרגש"
            };

            context.UpdateAnimalStoryDetail(ansd);
        }
예제 #7
0
        public void UpdateAnimalStoryDetailsAddStoryValidTest()
        {
            var details = context.GetAllAnimalStoryDetailsById(2);

            Assert.AreEqual(1, details.Count());

            var det = new AnimalStoryDetail
            {
                animalStoryId = 2,
                name          = "שוש הזברה",
                story         = "לשוש הזברה ספור מיוחד מאוד.",
                language      = (int)Languages.he
            };

            context.UpdateAnimalStoryDetail(det);

            details = context.GetAllAnimalStoryDetailsById(2);
            Assert.AreEqual(2, details.Count());
        }
예제 #8
0
        public void UpdateAnimalStoryDetail(AnimalStoryDetail animalStoryDetail)
        {
            try
            {
                using (var db = GetContext())
                {
                    if (!ValidateSessionId(db))
                    {
                        throw new AuthenticationException("Couldn't validate the session");
                    }

                    db.UpdateAnimalStoryDetail(animalStoryDetail);
                }
            }
            catch (Exception Exp)
            {
                var animalStoryDetailInput = "Animal Stroy Id: " + animalStoryDetail.animalStoryId + ", name: " + animalStoryDetail.name +
                                             ", story: " + animalStoryDetail.story + ", language: " + animalStoryDetail.language;
                Logger.GetInstance(isTesting).WriteLine(Exp.Message, Exp.StackTrace, animalStoryDetailInput);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
        }
예제 #9
0
        public void UpdateAnimalStoryDetailsValidInput()
        {
            var details = context.GetAllAnimalStoryDetailsById(1);

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

            var ansd = new AnimalStoryDetail
            {
                animalStoryId = 1,
                language      = (int)Languages.he,
                name          = "גילי הבבון",
                story         = "לגילי הבבון סיפור מיוחד ומרגש"
            };

            ansd.name = "אביב מאג";

            context.UpdateAnimalStoryDetail(ansd);

            details = context.GetAllAnimalStoryDetailsById(1);
            Assert.AreEqual(2, details.Count());
            Assert.IsTrue(details.Any(d => d.name == "אביב מאג"));
            Assert.IsFalse(details.Any(d => d.name == "גילי הבבון"));
        }