skip to Main Content

Can't setup mocked Redis IDatabase using Moq

This is my test for my cache in program: [Fact] public async Task Cache_Works_Correctly() { const string testkey = "69"; const string testvalue = "Nice"; var mockDatabase = new Mock<IDatabase>(); mockDatabase.Setup<string>(_ => _.StringGet(CacheConstants.NamePrefix + testkey, CommandFlags.None)).Returns(testvalue); var mockMultiplexer = new…

VIEW QUESTION

Redis Stream I need Event Driven Architecture,

When any new message received in the stream, on that time OnMessageReceived event should trigger. public event EventHandler<MqMessageReceivedEventArgs> OnMessageReceived; var result = await redisDatabase.StreamRangeAsync(StreamName, "-", "+", 1, Order.Ascending); protected virtual void OnMessageReceivedEvent(MqMessageReceivedEventArgs e) { OnMessageReceived?.Invoke(this, e); }

VIEW QUESTION
Back To Top
Search