示例#1
0
        public void DisconnectInactiveObservers_EstimationStartedActiveScrumMasterInactiveMember_ScrumMasterGetsEstimationResult()
        {
            // Arrange
            var dateTimeProvider = new DateTimeProviderMock();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 20));

            var target = new ScrumTeam("test team", dateTimeProvider);
            var master = target.SetScrumMaster("master");
            var member = (Member)target.Join("member", false);

            master.StartEstimation();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 30));
            master.Estimation = new Estimation();
            master.UpdateActivity();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 55));
            TestHelper.ClearMessages(master);

            // Act
            target.DisconnectInactiveObservers(TimeSpan.FromSeconds(30.0));

            // Verify
            Assert.AreEqual <TeamState>(TeamState.EstimationFinished, target.State);
            Assert.IsNotNull(target.EstimationResult);

            Assert.IsTrue(master.HasMessage);
            master.PopMessage();
            Assert.IsTrue(master.HasMessage);
            var message = master.PopMessage();

            Assert.AreEqual <MessageType>(MessageType.EstimationEnded, message.MessageType);
        }
示例#2
0
        public void DisconnectInactiveObservers_ActiveObserverAndInactiveMember_ObserverMessageReceived()
        {
            // Arrange
            var dateTimeProvider = new DateTimeProviderMock();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 20));

            var target = new ScrumTeam("test team", dateTimeProvider);
            var master = target.SetScrumMaster("master");
            var member = target.Join("member", false);

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 30));
            var       observer  = target.Join("observer", true);
            EventArgs eventArgs = null;

            observer.MessageReceived += new EventHandler((s, e) => eventArgs = e);

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 55));

            // Act
            target.DisconnectInactiveObservers(TimeSpan.FromSeconds(30.0));

            // Verify
            Assert.IsNotNull(eventArgs);
            Assert.IsTrue(observer.HasMessage);
            var message = observer.PopMessage();

            Assert.AreEqual <MessageType>(MessageType.MemberDisconnected, message.MessageType);
        }
示例#3
0
        public void UpdateActivity_UtcNowIsChanged_LastActivityIsChanged()
        {
            // Arrange
            var utcNow           = new DateTime(2012, 1, 2, 4, 50, 13);
            var dateTimeProvider = new DateTimeProviderMock();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 2, 3, 35, 0));

            var team   = ScrumTeamTestData.CreateScrumTeam("test team", dateTimeProvider: dateTimeProvider);
            var target = new Observer(team, "test");

            dateTimeProvider.SetUtcNow(utcNow);

            // Act
            target.UpdateActivity();
            var result = target.LastActivity;

            // Verify
            Assert.AreEqual <DateTime>(utcNow, result);
        }
示例#4
0
        public void DisconnectInactiveObservers_InactiveObserver_ObserverIsDisconnected()
        {
            // Arrange
            var dateTimeProvider = new DateTimeProviderMock();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 20));

            var name   = "test";
            var target = new ScrumTeam("test team", dateTimeProvider);

            target.Join(name, true);

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 55));

            // Act
            target.DisconnectInactiveObservers(TimeSpan.FromSeconds(30.0));

            // Verify
            Assert.AreEqual <int>(0, target.Observers.Count());
        }
示例#5
0
        public void DisconnectInactiveObservers_NoInactiveMembers_TeamIsUnchanged()
        {
            // Arrange
            var dateTimeProvider = new DateTimeProviderMock();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 20));

            var name   = "test";
            var target = new ScrumTeam("test team", dateTimeProvider);

            target.Join(name, false);

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 40));

            // Act
            target.DisconnectInactiveObservers(TimeSpan.FromSeconds(30.0));

            // Verify
            Assert.AreEqual <int>(1, target.Members.Count());
        }
示例#6
0
        public void LastActivity_AfterConstruction_ReturnsUtcNow()
        {
            // Arrange
            var utcNow           = new DateTime(2012, 1, 2, 4, 50, 13);
            var dateTimeProvider = new DateTimeProviderMock();

            dateTimeProvider.SetUtcNow(utcNow);

            var team   = ScrumTeamTestData.CreateScrumTeam("test team", dateTimeProvider: dateTimeProvider);
            var target = new Observer(team, "test");

            // Act
            var result = target.LastActivity;

            // Verify
            Assert.AreEqual <DateTime>(utcNow, result);
        }