Skip to content

Conversation

@shacharPash
Copy link
Contributor

Use redisFixture in all tests like this:

var db = redisFixture.Redis.GetDatabase();

instead of this:

var redis = ConnectionMultiplexer.Connect("localhost:6379");
var db = redis.GetDatabase();

This allows us more control over the tests, such as setting a default value for the connection and the ability to test on a variety of connections/ports

@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (980a77c) 94.16% compared to head (ee4ec88) 94.16%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #244   +/-   ##
=======================================
  Coverage   94.16%   94.16%           
=======================================
  Files          85       85           
  Lines        5178     5178           
  Branches      487      487           
=======================================
  Hits         4876     4876           
  Misses        178      178           
  Partials      124      124           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
var db = muxer.GetDatabase();
var db = redisFixture.Redis.GetDatabase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized something: these tests inside Doc might be written in such a way that the source code can be used inside documentation. I see there are special comments, like // REMOVE_START and // REMOVE_END, it looks like the source code is processed via some tool.

In that case, we should not use the fixture for these Doc tests, because the sample code would not work if someone tries to use it as-such.

@shacharPash shacharPash requested a review from gerzse February 12, 2024 10:20
@shacharPash shacharPash merged commit 9a607e0 into master Feb 13, 2024
@shacharPash shacharPash deleted the testViaRedisFixture branch February 13, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants