示例#1
0
        public void CanGetDbProviderServices_returns_false_if_service_provider_throws()
        {
            var mockServiceProvider = new Mock <IServiceProvider>();

            mockServiceProvider
            .Setup(p => p.GetService(typeof(DbProviderServices)))
            .Throws <InvalidOperationException>();

            Assert.False(LegacyDbProviderServicesUtils.CanGetDbProviderServices(mockServiceProvider.Object));
        }
示例#2
0
        public void CanGetDbProviderServices_returns_true_if_DbProviderServices_returned_from_service_provider()
        {
            var mockServiceProvider = new Mock <IServiceProvider>();

            mockServiceProvider
            .Setup(p => p.GetService(typeof(DbProviderServices)))
            .Returns(new Mock <DbProviderServices>());

            Assert.True(LegacyDbProviderServicesUtils.CanGetDbProviderServices(mockServiceProvider.Object));
        }
示例#3
0
 public void CanGetDbProviderServices_returns_false_if_DbProviderServices_not_returned_from_service_provider()
 {
     Assert.False(LegacyDbProviderServicesUtils.CanGetDbProviderServices(new Mock <IServiceProvider>().Object));
 }