public async Task Start_TeamCreatedFromServiceBus_TeamAttachedToPlanningPoker()
        {
            // Arrange
            var planningPoker    = new Mock <IAzurePlanningPoker>(MockBehavior.Strict);
            var serviceBus       = new Mock <IServiceBus>(MockBehavior.Strict);
            var dateTimeProvider = new DateTimeProviderMock();
            var target           = CreatePlanningPokerAzureNode(planningPoker.Object, serviceBus.Object, CreateConfigutartion(), dateTimeProvider: dateTimeProvider);

            var nodeMessage = new NodeMessage(NodeMessageType.TeamCreated)
            {
                Data = CreateSerializedBasicTeam()
            };
            var sendMessages = SetupServiceBus(serviceBus, target.NodeId, nodeMessage);

            ScrumTeam team = null;

            planningPoker.Setup(p => p.AttachScrumTeam(It.IsAny <ScrumTeam>()))
            .Callback <ScrumTeam>(t => team = t).Returns(default(IScrumTeamLock)).Verifiable();
            planningPoker.Setup(p => p.ObservableMessages).Returns(Observable.Empty <ScrumTeamMessage>()).Verifiable();
            planningPoker.Setup(p => p.SetTeamsInitializingList(It.IsAny <IEnumerable <string> >()));
            planningPoker.Setup(p => p.EndInitialization());

            // Act
            await target.Start();

            sendMessages();
            await target.Stop();

            // Verify
            planningPoker.Verify();
            serviceBus.Verify();
            Assert.IsNotNull(team);
            Assert.AreEqual <string>(TeamName, team.Name);
            Assert.AreEqual <DateTimeProvider>(dateTimeProvider, team.DateTimeProvider);
        }
        public async Task Start_MasterActivityFromServiceBus_MasterUpdatedActivityInTeam()
        {
            // Arrange
            var planningPoker = new Mock <IAzurePlanningPoker>(MockBehavior.Strict);
            var serviceBus    = new Mock <IServiceBus>(MockBehavior.Strict);
            var target        = CreatePlanningPokerAzureNode(planningPoker.Object, serviceBus.Object, CreateConfigutartion());

            var message = new ScrumTeamMemberMessage(TeamName, MessageType.MemberActivity)
            {
                MemberName = ScrumMasterName,
                MemberType = "ScrumMaster"
            };
            var nodeMessage = new NodeMessage(NodeMessageType.ScrumTeamMessage)
            {
                Data = message
            };
            var sendMessages = SetupServiceBus(serviceBus, target.NodeId, nodeMessage);

            var dateTimeProvider = new DateTimeProviderMock();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 9, 9, 23, 27, 33, DateTimeKind.Utc));

            var team = new ScrumTeam(TeamName, dateTimeProvider);

            team.SetScrumMaster(ScrumMasterName);
            var teamLock = SetupPlanningPoker(planningPoker, team);

            dateTimeProvider.SetUtcNow(new DateTime(2012, 9, 9, 23, 28, 27, DateTimeKind.Utc));

            // Act
            await target.Start();

            sendMessages();
            await target.Stop();

            // Verify
            planningPoker.Verify();
            serviceBus.Verify();
            teamLock.Verify();
            Assert.AreEqual <DateTime>(dateTimeProvider.UtcNow, team.ScrumMaster.LastActivity);
        }