public void GetProviderFactory_caches_factory_instances_on_net40() { var mockFinder = new Mock <ProviderRowFinder> { CallBase = true }; var service = new Net40DefaultDbProviderFactoryService(mockFinder.Object); Assert.Equal(SqlClientFactory.Instance, service.GetProviderFactory(new SqlConnection())); mockFinder.Verify( m => m.FindRow(It.IsAny <Type>(), It.IsAny <Func <DataRow, bool> >(), It.IsAny <IEnumerable <DataRow> >()), Times.Once()); Assert.Equal(SqlClientFactory.Instance, service.GetProviderFactory(new SqlConnection())); // Finder not called again mockFinder.Verify( m => m.FindRow(It.IsAny <Type>(), It.IsAny <Func <DataRow, bool> >(), It.IsAny <IEnumerable <DataRow> >()), Times.Once()); }
public void GetProviderFactory_caches_factory_instances_on_net40() { var mockFinder = new Mock<ProviderRowFinder> { CallBase = true }; var service = new Net40DefaultDbProviderFactoryService(mockFinder.Object); Assert.Equal(SqlClientFactory.Instance, service.GetProviderFactory(new SqlConnection())); mockFinder.Verify( m => m.FindRow(It.IsAny<Type>(), It.IsAny<Func<DataRow, bool>>(), It.IsAny<IEnumerable<DataRow>>()), Times.Once()); Assert.Equal(SqlClientFactory.Instance, service.GetProviderFactory(new SqlConnection())); // Finder not called again mockFinder.Verify( m => m.FindRow(It.IsAny<Type>(), It.IsAny<Func<DataRow, bool>>(), It.IsAny<IEnumerable<DataRow>>()), Times.Once()); }