예제 #1
0
            public void ThrowsArgumentExceptionForNullOrWhitespaceConnectionString()
            {
                var connectionString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextDefault);
                var objectContext = new TestObjectContextContainer(connectionString);

                ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => ConnectionStringHelper.SetConnectionString(objectContext, null));
                ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => ConnectionStringHelper.SetConnectionString(objectContext, string.Empty));
            }
예제 #2
0
            public void ThrowsArgumentExceptionForNullOrWhitespaceConnectionString()
            {
                var connectionString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextDefault);
                var objectContext    = new TestObjectContextContainer(connectionString);

                ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => ConnectionStringHelper.SetConnectionString(objectContext, null));
                ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => ConnectionStringHelper.SetConnectionString(objectContext, string.Empty));
            }
예제 #3
0
            public void SetsConnectionString()
            {
                var connectionString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextDefault);
                var objectContext = new TestObjectContextContainer(connectionString);

                objectContext.SetConnectionString(TestConnectionStrings.ObjectContextModified);

                var expectedConnectionString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextModified);
                Assert.AreEqual(expectedConnectionString, objectContext.Connection.ConnectionString);
            }
            public void ReturnsNamedConnectionString()
            {
                var context = new TestObjectContextContainer();

                string expectedString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextDefault);

                var connectionString = context.GetConnectionString();

                Assert.IsTrue(string.Equals(expectedString, connectionString, StringComparison.OrdinalIgnoreCase));
            }
            public void ReturnsNamedConnectionString()
            {
                var context = new TestObjectContextContainer();

                string expectedString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextDefault);

                var connectionString = context.GetConnectionString();

                Assert.AreEqual(expectedString, connectionString, true);
            }
            public void SetsConnectionString()
            {
                var connectionString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextDefault);
                var objectContext    = new TestObjectContextContainer(connectionString);

                objectContext.SetConnectionString(TestConnectionStrings.ObjectContextModified);

                var expectedConnectionString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextModified);

                Assert.AreEqual(expectedConnectionString, objectContext.Connection.ConnectionString);
            }
            public void ReturnsRealConnectionString()
            {
                using (var context = new TestObjectContextContainer())
                {
                    var expectedString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextModified);

                    context.SetConnectionString(TestConnectionStrings.ObjectContextModified);
                    var connectionString = context.GetConnectionString();

                    Assert.IsTrue(string.Equals(expectedString, connectionString, StringComparison.OrdinalIgnoreCase));
                }
            }
예제 #8
0
            public void ReturnsRealConnectionString()
            {
                var context = new TestObjectContextContainer();

                string expectedString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextModified);

                context.SetConnectionString(TestConnectionStrings.ObjectContextModified);
                var connectionString = context.GetConnectionString();

                Assert.AreEqual(expectedString, connectionString, true);
            }
예제 #9
0
            public void ReturnsRealConnectionString()
            {
                var context = new TestObjectContextContainer();

                string expectedString = EfConnectionStringHelper.GetEntityFrameworkConnectionString(typeof(TestObjectContextContainer), TestConnectionStrings.ObjectContextModified);

                context.SetConnectionString(TestConnectionStrings.ObjectContextModified);
                var connectionString = context.GetConnectionString();

                Assert.IsTrue(string.Equals(expectedString, connectionString, StringComparison.OrdinalIgnoreCase));
            }