I use AutoFixture with my BDD tests.
I'm trying to write a fixture for a User
class which in turn uses CentralConfiguration
class. CentralConfiguration
constructor looks like this:
public CentralConfiguration(
IConfigurationRepository configurationRepository,
ILogger logger)
{
_logger = logger;
_configuration = configurationRepository.Single();
LogPropertyValues();
}
The second line in the constructor, although working fine when used by a user, throws "Sequence contains no elements" exception every time I try to build a fixture for tests. I even tried building a Configuration
object manually and using
configuration.Single().Returns(myCustomObject)
but nothing changed (actually this line started throwing the same exception).
What am I doing wrong, and how can I circumvent this issue?