コード例 #1
0
 // private helper methods
 private static SessionViewModel CreateSessionViewModel(Session session)
 {
     return new SessionViewModel
                {
                    Abstract = session.Abstract,
                    End = session.End.AsDateTimeDisplay(),
                    Level = session.Level,
                    Room = session.Room,
                    SessionId = session.SessionId,
                    SpeakerId = session.SpeakerId,
                    Start = session.Start.AsDateTimeDisplay(),
                    Title = session.Title,
                    Track = session.Track
                };
 }
コード例 #2
0
        /// <summary>
        /// Given some "contents" attempt to parse to an instance of T
        /// </summary>
        /// <param name="contents">The contents which will be parsed</param>
        /// <returns></returns>
        public Session Parse(string contents)
        {
            JObject jToken = JObject.Parse(contents);
            var session = new Session
                       {
                           Abstract = new StringWrapper(jToken["Abstract"]).ToString(),
                           Level = new StringWrapper(jToken["Difficulty"]).ToString(),
                           SessionId = new StringWrapper(jToken["Title"]).ToString().GetHashCode(),
                           SpeakerId = new StringWrapper(jToken["SpeakerName"]).ToString().GetHashCode(),
                           Track = new StringWrapper(jToken["Technology"]).ToString(),
                           Room = new StringWrapper(jToken["Room"]).ToString(),
                           Title = new StringWrapper(jToken["Title"]).ToString(),
                           Start = new StringWrapper(jToken["Start"]).ToString().AsDateTime(),
                           End = new StringWrapper(jToken["End"]).ToString().AsDateTime()
                       };

            return session;
        }
コード例 #3
0
 public void test_that_if_an_attempt_to_update_a_non_existing_property_is_made_an_exception_is_raised()
 {
     var session = new Session();
     session.ApplyChange("MyProperty", "this new value");
 }
コード例 #4
0
 public void test_that_a_property_is_updated_with_the_correct_value_when_apply_change_is_called()
 {
     var session = new Session();
     session.ApplyChange("Title", "MyTest");
     Assert.AreEqual(session.Title, "MyTest");
 }