Closed 59977 closed 1 year ago
Hi @59977, Thanks for highlighting an issue,
I appreciate this doesn't entirely fit the constraints of unit testing, but for testing your configuration is set, your config is accessible in resulting session's SessionConfig
property.
so you can have a test like this
[Fact]
public void ShouldConfigureSessionCorrectly()
{
// Because no connection is made to the database until a connection is actually needed you can do this.
using var driver = GraphDatabase.Driver("bolt://localhost:7687", AuthTokens.None);
using var session = driver.AsyncSession(x => x.WithDatabase("testDb").WithDefaultAccessMode(AccessMode.Read));
Assert.Equal("testDb", session.SessionConfig.Database);
Assert.Equal(AccessMode.Read, session.SessionConfig.DefaultAccessMode);
}
Is your feature request related to a problem? Please describe. Consider the following code:
How can I test that the correct database and access mode is set in a unit test in a reasonable way?
Describe the solution you'd like Public constructors for SessionConfig and SessionConfigBuilder would be one approach.
Describe alternatives you've considered I know it's possible to do this using reflection but that is not a reasonable solution in my opinion.