Ejemplo n.º 1
0
        public void ReplaceTableTest(string context)
        {
            using (var db = new MyDataConnection(context))
            {
                db.BeginTransaction();

                var n = 555;

                Assert.Throws(
                    typeof(System.Data.SqlClient.SqlException),
                    () =>
                    db.Parent.Insert(() => new Parent
                {
                    ParentID = n,
                    Value1   = n
                }),
                    "Invalid object name 'Parent1'.");

                Assert.Throws(
                    typeof(System.Data.SqlClient.SqlException),
                    () =>
                    db.Parent.Insert(() => new Parent
                {
                    ParentID = n,
                    Value1   = n
                }),
                    "Invalid object name 'Parent1'.");

                db.Parent.Delete(p => p.ParentID == n);
            }
        }
Ejemplo n.º 2
0
        public void ReplaceTableTest([IncludeDataSources(TestProvName.AllSqlServer2008Plus)]
                                     string context)
        {
            using (var db = new MyDataConnection(context))
            {
                db.BeginTransaction();

                var n = 555;

                var ex = Assert.Throws(
                    Is.AssignableTo <Exception>(),
                    () =>
                    db.Parent.Insert(() => new Parent
                {
                    ParentID = n,
                    Value1   = n
                }),
                    "Invalid object name 'Parent1'.");
                Assert.True(ex.GetType().Name == "SqlException");

                ex = Assert.Throws(
                    Is.AssignableTo <Exception>(),
                    () =>
                    db.Parent.Insert(() => new Parent
                {
                    ParentID = n,
                    Value1   = n
                }),
                    "Invalid object name 'Parent1'.");
                Assert.True(ex.GetType().Name == "SqlException");

                db.Parent.Delete(p => p.ParentID == n);
            }
        }
Ejemplo n.º 3
0
		public void ReplaceTableTest(string context)
		{
			using (var db = new MyDataConnection(context))
			{
				db.BeginTransaction();

				var n = 555;

				Assert.Throws(
					typeof(System.Data.SqlClient.SqlException),
					() =>
						db.Parent.Insert(() => new Parent
						{
							ParentID = n,
							Value1   = n
						}),
					"Invalid object name 'Parent1'.");

				Assert.Throws(
					typeof(System.Data.SqlClient.SqlException),
					() =>
						db.Parent.Insert(() => new Parent
						{
							ParentID = n,
							Value1   = n
						}),
					"Invalid object name 'Parent1'.");

				db.Parent.Delete(p => p.ParentID == n);
			}
		}
Ejemplo n.º 4
0
        public void ReplaceTableTest([IncludeDataContexts(ProviderName.SqlServer2008)] string context)
        {
            using (var db = new MyDataConnection(context))
            {
                db.BeginTransaction();

                var n = 555;

                db.Parent.Insert(() => new Parent
                {
                    ParentID = n,
                    Value1   = n
                });

                db.Parent.Delete(p => p.ParentID == n);
            }
        }
Ejemplo n.º 5
0
        public void ReplaceTableTest([IncludeDataContexts(ProviderName.SqlServer2008)] string context)
        {
            using (var db = new MyDataConnection(context))
            {
                db.BeginTransaction();

                var n = 555;

                db.Parent.Insert(() => new Parent
                {
                    ParentID = n,
                    Value1   = n
                });

                db.Parent.Delete(p => p.ParentID == n);
            }
        }
Ejemplo n.º 6
0
        public void ReplaceTableTest(string context)
        {
            using (var db = new MyDataConnection(context))
            {
                db.BeginTransaction();

                var n = 555;

                db.Parent.Insert(() => new Parent
                {
                    ParentID = n,
                    Value1   = n
                });

                db.Parent.Delete(p => p.ParentID == n);
            }
        }
Ejemplo n.º 7
0
        public void ReplaceTableTest(string context)
        {
            using (var db = new MyDataConnection(context))
            {
                db.BeginTransaction();

                var n = 555;

                db.Parent.Insert(() => new Parent
                {
                    ParentID = n,
                    Value1   = n
                });

                db.Parent.Delete(p => p.ParentID == n);
            }
        }