コード例 #1
0
        public async Task GetConnectionAsync_ReturnOpenedConnection_When_PassingRealConnectionStringToCtor()
        {
            var factory = new SqlCeConnectionFactory(this.TestConnectionString);

            using (IDbConnection connection = await factory.GetConnectionAsync())
            {
                Assert.AreEqual(ConnectionState.Open, connection.State);
            }
        }
コード例 #2
0
        public void GetConnectionAsync_DoesNoThrow_When_PassingRealConnectionStringToCtor()
        {
            var factory = new SqlCeConnectionFactory(this.TestConnectionString);

            Assert.DoesNotThrowAsync(async() =>
            {
                using (await factory.GetConnectionAsync())
                {
                }
            });
        }
コード例 #3
0
        public void GetConnectionAsync_Throws_When_PassingRealConnectionStringToCtor()
        {
            var factory = new SqlCeConnectionFactory(@"Data Source=C:\Users\test_compact_db.sdf");

            Assert.ThrowsAsync <SqlCeException>(async() =>
            {
                using (IDbConnection connection = await factory.GetConnectionAsync())
                {
                    Assert.AreEqual(ConnectionState.Open, connection.State);
                }
            });
        }