Exemplo n.º 1
0
        public async Task Should_send_request()
        {
            var context = await this.SetupContext();

            var subject = new RoomNotificationHandler(
                context,
                this.mediator.Object,
                this.messageFactory.Object,
                this.connectionIdStore.Object);

            var notification = new RoomNotification(GameId);

            await subject.Handle(notification, default);

            var playerIds = new[]
            {
                HostConnectionId,
                ChallengerConnectionId
            };

            this.mediator.Verify(x => x.Send(
                                     It.Is <HubGroupNotify.Request>(
                                         y => y.Group == GameId.ToString() &&
                                         y.Message == Message &&
                                         new HashSet <string>(y.Excluded).SetEquals(playerIds)),
                                     It.IsAny <CancellationToken>()));
        }
Exemplo n.º 2
0
        public async Task Should_get_message_with_correct_parameters()
        {
            var context = await this.SetupContext();

            var subject = new RoomNotificationHandler(
                context,
                this.mediator.Object,
                this.messageFactory.Object,
                this.connectionIdStore.Object);

            var notification = new RoomNotification(GameId);

            await subject.Handle(notification, default);

            this.messageFactory.Verify(x => x.Create(
                                           It.Is <Messages.GameState.MessageData>(
                                               y => y.GameId == GameId &&
                                               !y.PlayerId.HasValue)));
        }