Beispiel #1
0
    public async Task SubscribeGetAll()
    {
        /* Given */
        var addedMessage = new Message
        {
            Content = "test",
            From    = new MessageFrom
            {
                DisplayName = "test",
                Id          = "1"
            },
            SentAt = DateTime.Now.Date
        };

        /* When */
        var result = await ExecuteSubscribeAsync(new ExecutionOptions
        {
            Query = "subscription messageGetAll { messageGetAll { from { id displayName } content sentAt } }",
        }).ConfigureAwait(false);

        Chat.AddMessageGetAll(addedMessage);

        /* Then */
        var stream  = result.Streams.Values.FirstOrDefault();
        var message = await stream.FirstOrDefaultAsync();

        message.ShouldNotBeNull();
        var data = message.Data.ToDict();

        data.ShouldNotBeNull();
        data["messageGetAll"].ShouldNotBeNull();
    }