public PairTrackerPresenter(PairTrackerView view, Session model, SessionPercentageStatisticGenerator statGenerator)
        {
            this.view = view;
            this.model = model;
            this.statGenerator = statGenerator;

            view.StartButton_Clicked += new EventHandler<StartButtonClickedEventArgs>(StartSession);
            view.StopButton_Clicked += new EventHandler<EventArgs>(EndSession);
            view.Controller_Changed += new EventHandler<ControllerChangedEventArgs>(ChangeControllerHandler);
        }
        public void SessionWith1IntervalResultsIn1ProgrammerWith100Percent()
        {
            var programmerJoe = new Programmer("Joe");
            var intervals = new List<Interval>();
            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 0), new TimeSpan(0, 0, 10), programmerJoe));
            var session = new TestSession(programmerJoe, new Programmer("Bob"), intervals);

            var statGenerator = new SessionPercentageStatisticGenerator();
            var results = statGenerator.Generate(session);

            Assert.That(results.Count, Is.EqualTo(1));
            Assert.That(results[programmerJoe].Percentage, Is.EqualTo(100));
        }
        public void SessionWith1IntervalResultsIn1ProgrammerWith100Percent()
        {
            var programmerJoe = new Programmer("Joe");
            var intervals     = new List <Interval>();

            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 0), new TimeSpan(0, 0, 10), programmerJoe));
            var session = new TestSession(programmerJoe, new Programmer("Bob"), intervals);

            var statGenerator = new SessionPercentageStatisticGenerator();
            var results       = statGenerator.Generate(session);

            Assert.That(results.Count, Is.EqualTo(1));
            Assert.That(results[programmerJoe].Percentage, Is.EqualTo(100));
        }
        public PairTrackerPresenter(PairTrackerView view, PairingSession model, AboutPresenter aboutPresenter, SessionPercentageStatisticGenerator statGenerator, Repository <PairingSession> repository)
        {
            this.view           = view;
            this.model          = model;
            this.statGenerator  = statGenerator;
            this.repository     = repository;
            this.aboutPresenter = aboutPresenter;

            view.StartButton_Clicked += new EventHandler <StartButtonClickedEventArgs>(StartSession);
            view.StopButton_Clicked  += new EventHandler <EventArgs>(EndSession);
            view.Controller_Changed  += new EventHandler <ControllerChangedEventArgs>(ChangeControllerHandler);
            view.CloseButton_Clicked += new EventHandler <CloseButtonClickedEventArgs>(Close);
            view.About_Clicked       += new EventHandler <EventArgs>(ShowAbout);
            view.PauseButton_Clicked += new EventHandler <EventArgs>(PauseSession);
        }
        public PairTrackerPresenter(PairTrackerView view, PairingSession model, AboutPresenter aboutPresenter, SessionPercentageStatisticGenerator statGenerator, Repository<PairingSession> repository)
        {
            this.view = view;
            this.model = model;
            this.statGenerator = statGenerator;
            this.repository = repository;
            this.aboutPresenter = aboutPresenter;

            view.StartButton_Clicked += new EventHandler<StartButtonClickedEventArgs>(StartSession);
            view.StopButton_Clicked += new EventHandler<EventArgs>(EndSession);
            view.Controller_Changed += new EventHandler<ControllerChangedEventArgs>(ChangeControllerHandler);
            view.CloseButton_Clicked += new EventHandler<CloseButtonClickedEventArgs>(Close);
            view.About_Clicked += new EventHandler<EventArgs>(ShowAbout);
            view.PauseButton_Clicked += new EventHandler<EventArgs>(PauseSession);
        }
        public void SessionWith2IntervalsOfOddLengthsResultsInTotalOf100Percent()
        {
            var programmerJoe = new Programmer("Joe");
            var programmerBob = new Programmer("Bob");
            var intervals = new List<Interval>();
            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 0), new TimeSpan(0, 0, 1), programmerJoe));
            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 1), new TimeSpan(0, 0, 7), programmerBob));
            var session = new TestSession(programmerJoe, programmerBob, intervals);

            var statGenerator = new SessionPercentageStatisticGenerator();
            var results = statGenerator.Generate(session);

            Assert.That(results.Count, Is.EqualTo(2));
            Assert.That(results[programmerJoe].Percentage, Is.EqualTo(12));
            Assert.That(results[programmerBob].Percentage, Is.EqualTo(88));
        }
        public void SessionWith2EqualIntervalsResultsIn2ProgrammersWith50PercentEach()
        {
            var programmerJoe = new Programmer("Joe");
            var programmerBob = new Programmer("Bob");
            var intervals = new List<Interval>();
            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 0), new TimeSpan(0, 0, 5), programmerJoe));
            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 5), new TimeSpan(0, 0, 5), programmerBob));
            var session = new TestSession(programmerJoe, programmerBob, intervals);

            var statGenerator = new SessionPercentageStatisticGenerator();
            var results = statGenerator.Generate(session);

            Assert.That(results.Count, Is.EqualTo(2));
            Assert.That(results[programmerJoe].Percentage, Is.EqualTo(50));
            Assert.That(results[programmerBob].Percentage, Is.EqualTo(50));
        }
        public void SessionWith2IntervalsOfOddLengthsResultsInTotalOf100Percent()
        {
            var programmerJoe = new Programmer("Joe");
            var programmerBob = new Programmer("Bob");
            var intervals     = new List <Interval>();

            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 0), new TimeSpan(0, 0, 1), programmerJoe));
            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 1), new TimeSpan(0, 0, 7), programmerBob));
            var session = new TestSession(programmerJoe, programmerBob, intervals);

            var statGenerator = new SessionPercentageStatisticGenerator();
            var results       = statGenerator.Generate(session);

            Assert.That(results.Count, Is.EqualTo(2));
            Assert.That(results[programmerJoe].Percentage, Is.EqualTo(12));
            Assert.That(results[programmerBob].Percentage, Is.EqualTo(88));
        }
        public void SessionWith2EqualIntervalsResultsIn2ProgrammersWith50PercentEach()
        {
            var programmerJoe = new Programmer("Joe");
            var programmerBob = new Programmer("Bob");
            var intervals     = new List <Interval>();

            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 0), new TimeSpan(0, 0, 5), programmerJoe));
            intervals.Add(new TestInterval(new DateTime(2000, 1, 1, 0, 0, 5), new TimeSpan(0, 0, 5), programmerBob));
            var session = new TestSession(programmerJoe, programmerBob, intervals);

            var statGenerator = new SessionPercentageStatisticGenerator();
            var results       = statGenerator.Generate(session);

            Assert.That(results.Count, Is.EqualTo(2));
            Assert.That(results[programmerJoe].Percentage, Is.EqualTo(50));
            Assert.That(results[programmerBob].Percentage, Is.EqualTo(50));
        }
Beispiel #10
0
 public PairTrackerPresenterBuilder WithStatGenerator(SessionPercentageStatisticGenerator statGenerator)
 {
     this.statGenerator = statGenerator;
     return(this);
 }
 public PairTrackerPresenterBuilder WithStatGenerator(SessionPercentageStatisticGenerator statGenerator)
 {
     this.statGenerator = statGenerator;
     return this;
 }