Пример #1
0
        public async Task NewGroup_Success_NotifyCurrentAndAllConnection()
        {
            var testPayload = new UserWssPayload {
                NewGroupName = TestGroupName
            };
            var testGroup = new Group {
                Id = TestGroupId
            };

            _chatServiceMock
            .Setup(s => s.NewGroupAsync(TestUserId, testPayload.NewGroupName))
            .ReturnsAsync((true, testGroup.Id));
            _chatServiceMock
            .Setup(s => s.GetGroupAsync(testGroup.Id))
            .ReturnsAsync(testGroup);

            await _target.NewGroup(testPayload);

            AssertMessageSentToCurrentConnection(ChatHub.NewGroupResultMessage,
                                                 content => ((NewGroupResultResponse)content).Group == testGroup);
            AssertMessageSentToAllConnections(ChatHub.NewGroupMessage,
                                              content => ((NewGroupResponse)content).Group == testGroup);
        }