I want to mock some method to throw NpgsqlException, like this:
_someMock.Setup(x => x.SomeMethod(It.IsAny<int>())).Throws(new NpgsqlException());
But there is no public constructor for NpgsqlException, I tried to use reflection instead but it found no constructors for this exception(even private)
//Arrange
var pgException = new PostgresException("messageText", "severity", "invariantSeverity", "sqlState");
//Setup
_someMock.Setup(x => x.SomeMethod(It.IsAny<int>())).ThrowsAsync(pgException);