Skip to content

DatabaseTargetTests - Add coverage for DbConnectionFactory constructor#67

Open
JohnVerheij wants to merge 1 commit intoNLog:masterfrom
JohnVerheij:tests/databasetarget-factory-ctor-coverage
Open

DatabaseTargetTests - Add coverage for DbConnectionFactory constructor#67
JohnVerheij wants to merge 1 commit intoNLog:masterfrom
JohnVerheij:tests/databasetarget-factory-ctor-coverage

Conversation

@JohnVerheij
Copy link
Copy Markdown
Contributor

Adds direct test coverage for the DatabaseTarget(Func<IDbConnection>) constructor introduced in NLog/NLog#5878. The factory constructor was previously covered indirectly through DbTypeEnumSetterTest, DbTypeSetterTest, and DbFactoryConnectionStringTest1/2; this brings parity with the existing tests for the legacy DBProvider constructor.

Tests added:

  • DbConnectionFactoryNullTest - null factory throws ArgumentNullException
  • DbConnectionFactoryReturnsNullTest - factory returning null surfaces NLogRuntimeException
  • DbConnectionFactoryThrowsTest - factory exceptions propagate to the async continuation
  • DbConnectionFactorySimpleWriteTest - end-to-end single write
  • DbConnectionFactoryBatchedWriteTest - end-to-end batched write
  • DbConnectionFactoryKeepConnectionTest - persistent-connection mode
  • DbConnectionFactoryWithParametersWriteTest - end-to-end write with Action<IDbDataParameter> parameter setter

All 222 tests pass on net8.0. No production code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant