Beispiel #1
0
        public IEnumerable<Talk> Load()
        {
            var registeredTalks = new List<Talk>();

            foreach (var talk in TalksList)
            {
                var unit = CheckForValidUnit(talk);
                string topic=null;

                var durationPosition = talk.IndexOfAny("0123456789".ToCharArray());

                var duration = "1";

                if (durationPosition == -1)
                    topic = talk.Substring(0, talk.LastIndexOf(unit, StringComparison.OrdinalIgnoreCase));
                else
                {
                    topic = talk.Substring(0, durationPosition);

                    duration = talk.Substring(durationPosition,
                             talk.LastIndexOfAny("0123456789".ToCharArray()) - durationPosition + 1);
                }

                var talkDuration = new TalkDuration((TimeUnit)Enum.Parse(typeof(TimeUnit), unit, true)
                                                    ,Convert.ToInt32(duration));

                registeredTalks.Add(new Talk(topic, talkDuration));
            }

            return registeredTalks;
        }
 public void Initialize()
 {
     _duration = new TalkDuration(TimeUnit.Min, 60);
     _scheduler=new SimpleScheduler();
     SetDaysSchedule();
     _testConference = new Conference(_scheduler,_days);
     _testConference.ResultFormatter = new TextFileFormatter();
 }
Beispiel #3
0
        public Talk(string topic, TalkDuration duration)
        {
            try
            {

                Duration = duration;
                if (IsInValidTitle(topic))
                    throw new ArgumentException("Title Cannot contain Numeric values");
                Topic = topic;
            }
            catch (ArgumentException e)
            {
                throw;
            }
        }
 public void ThrowExceptionForInvalidDuration()
 {
     _duration = new TalkDuration(TimeUnit.Min, -10);
     _testTalk = new Talk("Topic", _duration);
 }
 public void Initialize()
 {
     _duration = new TalkDuration(TimeUnit.Min, 60);
     _testTalk = new Talk("Topic", _duration);
 }