예제 #1
0
        public void Session_Throws_Error_Without_a_Topic_Or_StartTime()
        {
            var session = new Session();

            Assert.Throws<NullReferenceException>(null, "Topic is required");
            Assert.Throws<NullReferenceException>(null, "Start Time is required");
        }
예제 #2
0
        public void Session_must_have_a_Topic()
        {
            var session = new Session();
            session.Topic = "New Topic";

            Assert.IsNotNull(session.Topic);
        }
 public ActionResult Create(Session session, int speakerId)
 {
     try
     {
         var speaker = _repository.FindSpeakerBySpeakerId(speakerId);
         session.Speaker = speaker;
         _repository.InsertOrUpdate(session);
         _repository.Save();
         return RedirectToAction("List", new {speakerId = speakerId});
     }
     catch
     {
         return View();
     }
 }
        //
        // GET: /Session/Create
        public ActionResult Create(int speakerId)
        {
            var session = new Session();

            return View(session);
        }