Skip to content

Commit

Permalink
Changed back IMessageContext to MessageContext in TopicMessage.
Browse files Browse the repository at this point in the history
  • Loading branch information
fhubi committed Jun 17, 2024
1 parent 0af6810 commit 74157b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/messaging/dotnet/src/Core/MessageRouterExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static ValueTask<IDisposable> SubscribeAsync(
{
Func<IMessageBuffer, ValueTask> innerSubscriber = async messageBuffer =>
{
IMessageContext context = new MessageContext();
MessageContext context = new MessageContext();
var topicMessage = new TopicMessage(topic, messageBuffer, context);

observer.OnNext(topicMessage);
Expand Down
4 changes: 2 additions & 2 deletions src/messaging/dotnet/src/Core/TopicMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public sealed class TopicMessage
/// <param name="topic"></param>
/// <param name="payload"></param>
/// <param name="context"></param>
public TopicMessage(string topic, IMessageBuffer? payload, IMessageContext context)
public TopicMessage(string topic, IMessageBuffer? payload, MessageContext context)
{
Topic = topic;
Payload = payload;
Expand All @@ -47,5 +47,5 @@ public TopicMessage(string topic, IMessageBuffer? payload, IMessageContext conte
/// <summary>
/// Gets contextual information about the message.
/// </summary>
public IMessageContext Context { get; }
public MessageContext Context { get; }
}
3 changes: 2 additions & 1 deletion src/messaging/dotnet/test/Core.Tests/MessageBuffer.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

using System.Buffers;
using System.Text;
using System.Text.Json;
using MorganStanley.ComposeUI.Messaging.TestUtils;

namespace MorganStanley.ComposeUI.Messaging;
Expand Down Expand Up @@ -228,7 +229,7 @@ public void CreateJson_creates_a_MessageBuffer_with_the_JSON_string()
Value = "test-value"
};

var buffer = MessageBuffer.Factory.CreateJson(payload);
var buffer = MessageBuffer.CreateJson(payload);

JsonSerializer.Deserialize<TestPayload>(buffer.GetString()).Should().BeEquivalentTo(payload);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Text.Json;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using MorganStanley.ComposeUI.Messaging.Abstractions;
using Nito.AsyncEx;

namespace MorganStanley.ComposeUI.Messaging;
Expand Down Expand Up @@ -72,8 +73,8 @@ public async Task Client_can_invoke_a_registered_service()
var handlerMock = new Mock<MessageHandler>();

handlerMock
.Setup(_ => _.Invoke("test-service", It.IsAny<MessageBuffer?>(), It.IsAny<MessageContext>()))
.Returns(new ValueTask<MessageBuffer?>(MessageBuffer.Create("test-response")));
.Setup(_ => _.Invoke("test-service", It.IsAny<IMessageBuffer?>(), It.IsAny<IMessageContext>()))
.Returns(new ValueTask<IMessageBuffer?>(MessageBuffer.Create("test-response")));

await service.RegisterServiceAsync(endpoint: "test-service", handlerMock.Object);

Expand Down

0 comments on commit 74157b5

Please sign in to comment.