Exemple #1
0
        public async void LeaveReflectBoardGroupTest()
        {
            using (var hub = new ReflectHub(_logger, _appInsightsOptions))
            {
                // Set up mock objects
                var mockGroups = new Mock <IGroupManager>();
                mockGroups.Setup(x => x.AddToGroupAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()));
                hub.Groups  = mockGroups.Object;
                hub.Context = Mock.Of <HubCallerContext>();

                // Invoke method
                await hub.LeaveReflectBoardGroup("reflectBoardId");

                // Assert
                mockGroups.Verify(x => x.RemoveFromGroupAsync(It.IsAny <string>(), "reflectBoardId", It.IsAny <CancellationToken>()));
            }
        }
Exemple #2
0
        public async void BroadcastUpdatedBoardTest()
        {
            using (var hub = new ReflectHub(_logger, _appInsightsOptions))
            {
                // Set up mock objects
                var mockClientProxy = new Mock <IClientProxy>();
                var mockClients     = new Mock <IHubCallerClients>();
                mockClients.SetupGet(x => x.Others).Returns(mockClientProxy.Object);
                hub.Clients = mockClients.Object;
                hub.Context = Mock.Of <HubCallerContext>();

                // Invoke method
                await hub.BroadcastUpdatedBoard("teamId", "reflectBoardId");

                // Assert
                mockClientProxy.Verify(x => x.SendCoreAsync(
                                           receiveUpdatedBoard.ToString(),
                                           new string[] { "teamId", "reflectBoardId" },
                                           default(CancellationToken)));
            }
        }
Exemple #3
0
        public async void BroadcastDeletedItemTest()
        {
            using (var hub = new ReflectHub(_logger, _appInsightsOptions))
            {
                // Set up mock objects
                var mockClientProxy = new Mock <IClientProxy>();
                var mockClients     = new Mock <IHubCallerClients>();
                mockClients.Setup(x => x.OthersInGroup(It.IsAny <string>())).Returns(mockClientProxy.Object);
                hub.Clients = mockClients.Object;
                hub.Context = Mock.Of <HubCallerContext>();

                // Invoke method
                await hub.BroadcastDeletedItem("reflectBoardId", "columnId", "feedbackItemId");

                // Assert
                mockClients.Verify(x => x.OthersInGroup("reflectBoardId"));
                mockClientProxy.Verify(x => x.SendCoreAsync(
                                           receiveDeletedItem.ToString(),
                                           new string[] { "columnId", "feedbackItemId" },
                                           default(CancellationToken)));
            }
        }