public void UpdateEnclosureDetailsEncDoesntExists() { var encs = enclosureController.GetAllEnclosureResults((int)Languages.en); Assert.AreEqual(4, encs.Count()); var enc = new EnclosureDetail { encId = -4, name = "Lions enclosure", language = (int)Languages.en, story = "This is a story" }; enclosureController.UpdateEnclosureDetail(enc); }
public void UpdateEnclosureDetailsWrongLanguage() { var encs = enclosureController.GetAllEnclosureResults((int)Languages.en); Assert.IsNotNull(encs); Assert.AreEqual(4, encs.Count()); var enc = new EnclosureDetail { encId = 2, name = "Monkeys", story = "Finalt they are here", language = -4 }; enclosureController.UpdateEnclosureDetail(enc); }
public void UpdateEnclosureDetailsEmptyName() { var encs = context.GetAllEnclosureResults((int)Languages.en); Assert.IsNotNull(encs); Assert.AreEqual(4, encs.Count()); var enc = new EnclosureDetail { encId = 2, name = "", story = "Finalt they are here", language = (int)Languages.en }; context.UpdateEnclosureDetails(enc); }
public void UpdateEnclosureDetailsUpdateEncDetExistingName() { var encs = enclosureController.GetAllEnclosureResults((int)Languages.en); Assert.IsNotNull(encs); Assert.AreEqual(4, encs.Count()); var enc = new EnclosureDetail { encId = 2, language = (int)Languages.en, //english name = "Houman Monkeys", story = "Computer Science students." }; enc.name = "Monkeys"; enclosureController.UpdateEnclosureDetail(enc); }
public void GetEnclosureDetailsByIdValidInput() { // 2 details IEnumerable <EnclosureDetail> details = enclosureController.GetEnclosureDetailsById(1); Assert.AreEqual(2, details.Count()); EnclosureDetail enc = details.First(); Assert.AreEqual("תצוגת הקופים", enc.name); enc = details.Last(); Assert.AreEqual("Monkeys", enc.name); //1 detial details = enclosureController.GetEnclosureDetailsById(4); Assert.AreEqual(1, details.Count()); enc = details.First(); Assert.AreEqual("קרנף לבן", enc.name); }
public void UpdateEnclosureDetailsAddEncDetValidInput() { var details = enclosureController.GetEnclosureDetailsById(4); Assert.AreEqual(1, details.Count()); Assert.AreEqual("קרנף לבן", details.First().name); var enc = new EnclosureDetail { encId = 4, name = "Rhino enclosure", language = (int)Languages.en, story = "This is a story" }; enclosureController.UpdateEnclosureDetail(enc); details = enclosureController.GetEnclosureDetailsById(4); Assert.AreEqual(2, details.Count()); Assert.AreEqual("Rhino enclosure", details.SingleOrDefault(d => d.language == (int)Languages.en).name); }
public void UpdateEnclosureDetail(EnclosureDetail enclosureDetail) { try { using (var db = this.GetContext()) { if (ValidateSessionId(db)) { db.UpdateEnclosureDetails(enclosureDetail); } else { throw new AuthenticationException("Couldn't validate the session"); } } } catch (Exception Exp) { string enclosureDetailInput = "Enclosure Id: " + enclosureDetail.encId + ", name: " + enclosureDetail.name + ", story: " + enclosureDetail.story + ", language: " + enclosureDetail.language; Logger.GetInstance(isTesting).WriteLine(Exp.Message, Exp.StackTrace, "Enclosure Details: " + enclosureDetailInput); throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }
public void UpdateEnclosureDetailsUpdateEncDetValidInput() { var details = enclosureController.GetEnclosureDetailsById(4); Assert.AreEqual(1, details.Count()); Assert.AreEqual("קרנף לבן", details.First().name); var enc = new EnclosureDetail { encId = 2, language = (int)Languages.he, //hebrew name = "קופי אדם", story = "הקופים שלנו הם הכי חכמים!" }; enc.name = "123"; enclosureController.UpdateEnclosureDetail(enc); details = enclosureController.GetEnclosureDetailsById(2); Assert.AreEqual(2, details.Count()); Assert.AreEqual("123", details.SingleOrDefault(d => d.language == (int)Languages.he).name); Assert.AreEqual("Houman Monkeys", details.SingleOrDefault(d => d.language == (int)Languages.en).name); }