public void Should_update_the_session_count_when_adding_a_session()
        {
            var conference = new Conference("Something");
            var session = new Session("Foo", "Bar", new Speaker("Joe", "Schmoe"));

            conference.AddSession(session);

            conference.SessionCount.ShouldEqual(1);
        }
        public void Should_build_association_with_session_when_adding_session()
        {
            var conference = new Conference("Something");
            var session = new Session("Foo", "Bar", new Speaker("Joe", "Schmoe"));

            conference.AddSession(session);

            session.Conference.ShouldEqual(conference);
            conference.GetSessions().Any(s => s == session).ShouldBeTrue();
        }
        public void Should_map_session_fields()
        {
            var speaker = new Speaker("Joe", "Schmoe");
            var session = new Session("Foo", new string('a', 5000), speaker);

            SaveEntities(session);

            var loaded = SessionSource.CreateSession().Load<Session>(session.Id);

            loaded.Title.ShouldEqual(session.Title);
            loaded.Abstract.ShouldEqual(session.Abstract);
        }
        public void Should_cascade_to_speaker()
        {
            var speaker = new Speaker("Joe", "Schmoe");
            var session = new Session("Foo", "Bar", speaker);

            SaveEntities(session);

            var loaded = SessionSource.CreateSession().Load<Session>(session.Id);

            loaded.Speaker.ShouldEqual(speaker);

            loaded.Speaker.GetSessions().Count().ShouldEqual(1);
        }
        public void Should_construct_session_with_title_abstract_and_speaker()
        {
            var title = "Some Title";
            var @abstract = "A bunch of stuff";
            var speaker = new Speaker("Joe", "Schmoe");

            var session = new Session(title, @abstract, speaker);

            session.Title.ShouldEqual(title);
            session.Abstract.ShouldEqual(@abstract);
            session.Speaker.ShouldEqual(speaker);
            speaker.GetSessions().Any(s => s == session).ShouldBeTrue();
        }
        public void Should_cascade_session()
        {
            var newEvent = new Conference("Some event");
            var session = new Session("Foo", "Bar", new Speaker("Joe", "Schmoe"));

            newEvent.AddSession(session);

            SaveEntities(newEvent);

            var loaded = SessionSource.CreateSession().Load<Conference>(newEvent.Id);

            loaded.SessionCount.ShouldEqual(1);
            loaded.GetSessions().Count().ShouldEqual(1);
            loaded.GetSessions().ElementAt(0).Conference.ShouldEqual(loaded);
        }
 public virtual void AddSession(Session session)
 {
     _sessions.Add(session);
     session.Conference = this;
     SessionCount++;
 }
Beispiel #8
0
 	public virtual void Register(Session session)
 	{
 		_sessions.Add(session);
 	}