public void OpenConnection_CreateProviderWithConnectionAndOpenIt_ReturnsUnderlyingOpenedConnection() { var provider = A.Fake<IProvider>(); var underlyingConnection = A.Fake<IDbConnection>(); A.CallTo(() => provider.CreateConnection()).Returns(underlyingConnection); var dataSource = new DataSource(provider); var connection = dataSource.OpenConnection(); A.CallTo(() => underlyingConnection.Open()).MustHaveHappened(Repeated.Exactly.Once); Assert.AreEqual(underlyingConnection, connection); }