PageRenderTime 6ms CodeModel.GetById 13ms app.highlight 29ms RepoModel.GetById 1ms app.codeStats 0ms

/UnitTests/Linq/UpdateTest.cs

http://github.com/igor-tkachev/bltoolkit
C# | 749 lines | 618 code | 127 blank | 4 comment | 99 complexity | fb8a4273261379b385a9688dff03f111 MD5 | raw file
  1using System;
  2using System.Collections.Generic;
  3using System.Data;
  4using System.Linq;
  5
  6using BLToolkit.Data;
  7using BLToolkit.Data.DataProvider;
  8using BLToolkit.Data.Linq;
  9using BLToolkit.DataAccess;
 10using BLToolkit.Mapping;
 11using BLToolkit.Mapping.MemberMappers;
 12using NUnit.Framework;
 13
 14using Data.Linq;
 15using Data.Linq.Model;
 16
 17#region ReSharper disable
 18// ReSharper disable ConvertToConstant.Local
 19#endregion
 20
 21namespace Update
 22{
 23	[TestFixture]
 24	public class UpdateTest : TestBase
 25	{
 26		[Test]
 27		public void Update1()
 28		{
 29			ForEachProvider(db =>
 30			{
 31				try
 32				{
 33					var parent = new Parent1 { ParentID = 1001, Value1 = 1001 };
 34
 35					db.Parent.Delete(p => p.ParentID > 1000);
 36					db.Insert(parent);
 37
 38					Assert.AreEqual(1, db.Parent.Count (p => p.ParentID == parent.ParentID));
 39					Assert.AreEqual(1, db.Parent.Update(p => p.ParentID == parent.ParentID, p => new Parent { ParentID = p.ParentID + 1 }));
 40					Assert.AreEqual(1, db.Parent.Count (p => p.ParentID == parent.ParentID + 1));
 41				}
 42				finally
 43				{
 44					db.Child.Delete(c => c.ChildID > 1000);
 45					db.Parent.Delete(p => p.ParentID > 1000);
 46				}
 47			});
 48		}
 49
 50		[Test]
 51		public void Update2()
 52		{
 53			ForEachProvider(db =>
 54			{
 55				try
 56				{
 57					var parent = new Parent1 { ParentID = 1001, Value1 = 1001 };
 58
 59					db.Parent.Delete(p => p.ParentID > 1000);
 60					db.Insert(parent);
 61
 62					Assert.AreEqual(1, db.Parent.Count(p => p.ParentID == parent.ParentID));
 63					Assert.AreEqual(1, db.Parent.Where(p => p.ParentID == parent.ParentID).Update(p => new Parent { ParentID = p.ParentID + 1 }));
 64					Assert.AreEqual(1, db.Parent.Count(p => p.ParentID == parent.ParentID + 1));
 65				}
 66				finally
 67				{
 68					db.Child.Delete(c => c.ChildID > 1000);
 69					db.Parent.Delete(p => p.ParentID > 1000);
 70				}
 71			});
 72		}
 73
 74		[Test]
 75		public void Update3()
 76		{
 77			ForEachProvider(new[] { ProviderName.Informix }, db =>
 78			{
 79				try
 80				{
 81					var id = 1001;
 82
 83					db.Child.Delete(c => c.ChildID > 1000);
 84					db.Child.Insert(() => new Child { ParentID = 1, ChildID = id});
 85
 86					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id));
 87					Assert.AreEqual(1, db.Child.Where(c => c.ChildID == id && c.Parent.Value1 == 1).Update(c => new Child { ChildID = c.ChildID + 1 }));
 88					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id + 1));
 89				}
 90				finally
 91				{
 92					db.Child.Delete(c => c.ChildID > 1000);
 93				}
 94			});
 95		}
 96
 97		[Test]
 98		public void Update4()
 99		{
100			ForEachProvider(new[] { ProviderName.Informix }, db =>
101			{
102				try
103				{
104					var id = 1001;
105
106					db.Child.Delete(c => c.ChildID > 1000);
107					db.Child.Insert(() => new Child { ParentID = 1, ChildID = id});
108
109					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id));
110					Assert.AreEqual(1,
111						db.Child
112							.Where(c => c.ChildID == id && c.Parent.Value1 == 1)
113								.Set(c => c.ChildID, c => c.ChildID + 1)
114							.Update());
115					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id + 1));
116				}
117				finally
118				{
119					db.Child.Delete(c => c.ChildID > 1000);
120				}
121			});
122		}
123
124		[Test]
125		public void Update5()
126		{
127			ForEachProvider(new[] { ProviderName.Informix }, db =>
128			{
129				try
130				{
131					var id = 1001;
132
133					db.Child.Delete(c => c.ChildID > 1000);
134					db.Child.Insert(() => new Child { ParentID = 1, ChildID = id});
135
136					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id));
137					Assert.AreEqual(1,
138						db.Child
139							.Where(c => c.ChildID == id && c.Parent.Value1 == 1)
140								.Set(c => c.ChildID, () => id + 1)
141							.Update());
142					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id + 1));
143				}
144				finally
145				{
146					db.Child.Delete(c => c.ChildID > 1000);
147				}
148			});
149		}
150
151		[Test]
152		public void Update6()
153		{
154			ForEachProvider(new[] { ProviderName.Informix }, db =>
155			{
156				try
157				{
158					var id = 1001;
159
160					db.Parent4.Delete(p => p.ParentID > 1000);
161					db.Insert(new Parent4 { ParentID = id, Value1 = TypeValue.Value1 });
162
163					Assert.AreEqual(1, db.Parent4.Count(p => p.ParentID == id && p.Value1 == TypeValue.Value1));
164					Assert.AreEqual(1,
165						db.Parent4
166							.Where(p => p.ParentID == id)
167								.Set(p => p.Value1, () => TypeValue.Value2)
168							.Update());
169					Assert.AreEqual(1, db.Parent4.Count(p => p.ParentID == id && p.Value1 == TypeValue.Value2));
170				}
171				finally
172				{
173					db.Parent4.Delete(p => p.ParentID > 1000);
174				}
175			});
176		}
177
178		[Test]
179		public void Update7()
180		{
181			ForEachProvider(new[] { ProviderName.Informix }, db =>
182			{
183				try
184				{
185					var id = 1001;
186
187					db.Parent4.Delete(p => p.ParentID > 1000);
188					db.Insert(new Parent4 { ParentID = id, Value1 = TypeValue.Value1 });
189
190					Assert.AreEqual(1, db.Parent4.Count(p => p.ParentID == id && p.Value1 == TypeValue.Value1));
191					Assert.AreEqual(1,
192						db.Parent4
193							.Where(p => p.ParentID == id)
194								.Set(p => p.Value1, TypeValue.Value2)
195							.Update());
196					Assert.AreEqual(1, db.Parent4.Count(p => p.ParentID == id && p.Value1 == TypeValue.Value2));
197
198					Assert.AreEqual(1,
199						db.Parent4
200							.Where(p => p.ParentID == id)
201								.Set(p => p.Value1, TypeValue.Value3)
202							.Update());
203					Assert.AreEqual(1, db.Parent4.Count(p => p.ParentID == id && p.Value1 == TypeValue.Value3));
204				}
205				finally
206				{
207					db.Parent4.Delete(p => p.ParentID > 1000);
208				}
209			});
210		}
211
212		[Test]
213		public void Update8()
214		{
215			ForEachProvider(db =>
216			{
217				try
218				{
219					var parent = new Parent1 { ParentID = 1001, Value1 = 1001 };
220
221					db.Parent.Delete(p => p.ParentID > 1000);
222					db.Insert(parent);
223
224					parent.Value1++;
225
226					db.Update(parent);
227
228					Assert.AreEqual(1002, db.Parent.Single(p => p.ParentID == parent.ParentID).Value1);
229				}
230				finally
231				{
232					db.Child .Delete(c => c.ChildID > 1000);
233					db.Parent.Delete(p => p.ParentID > 1000);
234				}
235			});
236		}
237
238		[Test]
239		public void Update9()
240		{
241			ForEachProvider(new[] { ProviderName.Informix, ProviderName.SqlCe, ProviderName.DB2, ProviderName.Firebird, "Oracle", "DevartOracle", ProviderName.OracleManaged, ProviderName.PostgreSQL, ProviderName.MySql, ProviderName.SQLite, ProviderName.Access }, db =>
242			{
243				try
244				{
245					var id = 1001;
246
247					db.Child.Delete(c => c.ChildID > 1000);
248					db.Child.Insert(() => new Child { ParentID = 1, ChildID = id});
249
250					var q =
251						from c in db.Child
252						join p in db.Parent on c.ParentID equals p.ParentID
253						where c.ChildID == id && c.Parent.Value1 == 1
254						select new { c, p };
255
256					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id));
257					Assert.AreEqual(1, q.Update(db.Child, _ => new Child { ChildID = _.c.ChildID + 1, ParentID = _.p.ParentID }));
258					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id + 1));
259				}
260				finally
261				{
262					db.Child.Delete(c => c.ChildID > 1000);
263				}
264			});
265		}
266
267		[Test]
268		public void Update10()
269		{
270			ForEachProvider(new[] { ProviderName.Informix, ProviderName.SqlCe, ProviderName.DB2, ProviderName.Firebird, "Oracle", "DevartOracle", ProviderName.OracleManaged, ProviderName.PostgreSQL, ProviderName.MySql, ProviderName.SQLite, ProviderName.Access }, db =>
271			{
272				try
273				{
274					var id = 1001;
275
276					db.Child.Delete(c => c.ChildID > 1000);
277					db.Child.Insert(() => new Child { ParentID = 1, ChildID = id});
278
279					var q =
280						from p in db.Parent
281						join c in db.Child on p.ParentID equals c.ParentID
282						where c.ChildID == id && c.Parent.Value1 == 1
283						select new { c, p };
284
285					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id));
286					Assert.AreEqual(1, q.Update(db.Child, _ => new Child { ChildID = _.c.ChildID + 1, ParentID = _.p.ParentID }));
287					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id + 1));
288				}
289				finally
290				{
291					db.Child.Delete(c => c.ChildID > 1000);
292				}
293			});
294		}
295
296		//[Test]
297		public void Update11()
298		{
299			ForEachProvider(db =>
300			{
301				var q = db.GetTable<LinqDataTypes2>().Union(db.GetTable<LinqDataTypes2>());
302
303				//db.GetTable<LinqDataTypes2>().Update(_ => q.Contains(_), _ => new LinqDataTypes2 { GuidValue = _.GuidValue });
304
305				q.Update(_ => new LinqDataTypes2 { GuidValue = _.GuidValue });
306			});
307		}
308
309		[Test]
310		public void Update12()
311		{
312			ForEachProvider(db =>
313			{
314				var parent3 = db.GetTable<Parent3>();
315				try
316				{
317					var id = 1001;
318
319					parent3.Delete(_ => _.ParentID2 > 1000);
320					parent3.Insert(() => new Parent3() { ParentID2 = id, Value = id});
321
322					Assert.AreEqual(1, parent3.Where(_ => _.ParentID2 == id).Set(_ => _.ParentID2, id+1).Set(_ => _.Value, _ => _.ParentID2).Update());
323
324					var obj = parent3.FirstOrDefault(_ => _.ParentID2 == id + 1);
325					Assert.IsNotNull(obj);
326
327					db.Update(obj);
328
329				}
330				finally
331				{
332					parent3.Delete(_ => _.ParentID2 > 1000);
333				}
334			});
335		}
336
337
338		[Test]
339		public void UpdateAssociation1([DataContexts(ProviderName.Sybase, ProviderName.Informix)] string context)
340		{
341			using (var db = GetDataContext(context))
342			{
343				const int childId  = 10000;
344				const int parentId = 20000;
345
346				try
347				{
348					db.Child. Delete(x => x.ChildID  == childId);
349					db.Parent.Delete(x => x.ParentID == parentId);
350
351					db.Parent.Insert(() => new Parent { ParentID = parentId, Value1 = parentId });
352					db.Child. Insert(() => new Child  { ChildID = childId, ParentID = parentId });
353
354					var parents =
355						from child in db.Child
356						where child.ChildID == childId
357						select child.Parent;
358
359					Assert.AreEqual(1, parents.Update(db.Parent, x => new Parent { Value1 = 5 }));
360				}
361				finally
362				{
363					db.Child. Delete(x => x.ChildID  == childId);
364					db.Parent.Delete(x => x.ParentID == parentId);
365				}
366			}
367		}
368
369		[Test]
370		public void UpdateAssociation2([DataContexts(ProviderName.Sybase, ProviderName.Informix)] string context)
371		{
372			using (var db = GetDataContext(context))
373			{
374				const int childId  = 10000;
375				const int parentId = 20000;
376
377				try
378				{
379					db.Child. Delete(x => x.ChildID  == childId);
380					db.Parent.Delete(x => x.ParentID == parentId);
381
382					db.Parent.Insert(() => new Parent { ParentID = parentId, Value1 = parentId });
383					db.Child. Insert(() => new Child  { ChildID = childId, ParentID = parentId });
384
385					var parents =
386						from child in db.Child
387						where child.ChildID == childId
388						select child.Parent;
389
390					Assert.AreEqual(1, parents.Update(x => new Parent { Value1 = 5 }));
391				}
392				finally
393				{
394					db.Child. Delete(x => x.ChildID  == childId);
395					db.Parent.Delete(x => x.ParentID == parentId);
396				}
397			}
398		}
399
400		[Test]
401		public void UpdateAssociation3([DataContexts(ProviderName.Sybase, ProviderName.Informix)] string context)
402		{
403			using (var db = GetDataContext(context))
404			{
405				const int childId  = 10000;
406				const int parentId = 20000;
407
408				try
409				{
410					db.Child. Delete(x => x.ChildID  == childId);
411					db.Parent.Delete(x => x.ParentID == parentId);
412
413					db.Parent.Insert(() => new Parent { ParentID = parentId, Value1 = parentId });
414					db.Child. Insert(() => new Child  { ChildID = childId, ParentID = parentId });
415
416					var parents =
417						from child in db.Child
418						where child.ChildID == childId
419						select child.Parent;
420
421					Assert.AreEqual(1, parents.Update(x => x.ParentID > 0, x => new Parent { Value1 = 5 }));
422				}
423				finally
424				{
425					db.Child. Delete(x => x.ChildID  == childId);
426					db.Parent.Delete(x => x.ParentID == parentId);
427				}
428			}
429		}
430
431		[Test]
432		public void UpdateAssociation4([DataContexts(ProviderName.Sybase, ProviderName.Informix)] string context)
433		{
434			using (var db = GetDataContext(context))
435			{
436				const int childId  = 10000;
437				const int parentId = 20000;
438
439				try
440				{
441					db.Child. Delete(x => x.ChildID  == childId);
442					db.Parent.Delete(x => x.ParentID == parentId);
443
444					db.Parent.Insert(() => new Parent { ParentID = parentId, Value1 = parentId });
445					db.Child. Insert(() => new Child  { ChildID = childId, ParentID = parentId });
446
447					var parents =
448						from child in db.Child
449						where child.ChildID == childId
450						select child.Parent;
451
452					Assert.AreEqual(1, parents.Set(x => x.Value1, 5).Update());
453				}
454				finally
455				{
456					db.Child. Delete(x => x.ChildID  == childId);
457					db.Parent.Delete(x => x.ParentID == parentId);
458				}
459			}
460		}
461
462		static readonly Func<TestDbManager,int,string,int> _updateQuery =
463			CompiledQuery.Compile   <TestDbManager,int,string,int>((ctx,key,value) =>
464				ctx.Person
465					.Where(_ => _.ID == key)
466					.Set(_ => _.FirstName, value)
467					.Update());
468
469		[Test]
470		public void CompiledUpdate()
471		{
472			using (var ctx = new TestDbManager())
473			{
474				_updateQuery(ctx, 12345, "54321");
475			}
476		}
477
478#pragma warning disable 0649
479		[TableName("LinqDataTypes")]
480		class Table1
481		{
482			public int  ID;
483			public bool BoolValue;
484
485			[Association(ThisKey = "ID", OtherKey = "ParentID", CanBeNull = false)]
486			public List<Table2> Tables2;
487		}
488
489		[TableName("Parent")]
490		class Table2
491		{
492			public int  ParentID;
493			public bool Value1;
494
495			[Association(ThisKey = "ParentID", OtherKey = "ID", CanBeNull = false)]
496			public Table1 Table1;
497		}
498#pragma warning restore 0649
499
500		[Test]
501		public void UpdateAssociation5([DataContexts(
502			ProviderName.Access, ProviderName.DB2, ProviderName.Firebird, ProviderName.Informix, "Oracle", ProviderName.OracleManaged, ProviderName.PostgreSQL, ProviderName.SqlCe, ProviderName.SQLite,
503			ExcludeLinqService=true)] string context)
504		{
505			using (var db = new DbManager(context))
506			{
507				var ids = new[] { 10000, 20000 };
508
509				db.GetTable<Table2>()
510					.Where (x => ids.Contains(x.ParentID))
511					.Select(x => x.Table1)
512					.Distinct()
513					.Set(y => y.BoolValue, y => y.Tables2.All(x => x.Value1))
514					.Update();
515
516				var idx = db.LastQuery.IndexOf("INNER JOIN");
517
518				Assert.That(idx, Is.Not.EqualTo(-1));
519
520				idx = db.LastQuery.IndexOf("INNER JOIN", idx + 1);
521
522				Assert.That(idx, Is.EqualTo(-1));
523			}
524		}
525
526		[Test]
527		public void AsUpdatableTest([DataContexts(ProviderName.Informix)] string context)
528		{
529			using (var db = GetDataContext(context))
530			{
531				try
532				{
533					var id = 1001;
534
535					db.Child.Delete(c => c.ChildID > 1000);
536					db.Child.Insert(() => new Child { ParentID = 1, ChildID = id});
537
538					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id));
539
540					var q  = db.Child.Where(c => c.ChildID == id && c.Parent.Value1 == 1);
541					var uq = q.AsUpdatable();
542
543					uq = uq.Set(c => c.ChildID, c => c.ChildID + 1);
544
545					Assert.AreEqual(1, uq.Update());
546					Assert.AreEqual(1, db.Child.Count(c => c.ChildID == id + 1));
547				}
548				finally
549				{
550					db.Child.Delete(c => c.ChildID > 1000);
551				}
552			}
553		}
554
555		[TableName("GrandChild")]
556		class Table3
557		{
558			[PrimaryKey(1)] public int? ParentID;
559			[PrimaryKey(2)] public int? ChildID;
560			                public int? GrandChildID;
561		}
562
563		[Test]
564		public void UpdateNullablePrimaryKey([DataContexts] string context)
565		{
566			using (var db = GetDataContext(context))
567			{
568				db.Update(new Table3 { ParentID = 10000, ChildID = null, GrandChildID = 1000 });
569
570				if (db is DbManager)
571					Assert.IsTrue(((DbManager)db).LastQuery.Contains("IS NULL"));
572
573				db.Update(new Table3 { ParentID = 10000, ChildID = 111, GrandChildID = 1000 });
574
575				if (db is DbManager)
576					Assert.IsFalse(((DbManager)db).LastQuery.Contains("IS NULL"));
577			}
578		}
579
580		public class TestObject
581		{
582			public int Value { get; set; }
583		}
584
585		[TableName("TestIdentity")]
586		public class Table4
587		{
588			[PrimaryKey, MapField("ID"), Identity]
589			public int Id;
590			[MemberMapper(typeof(JSONSerialisationMapper))]
591			[MapField("StringValue"), DbType(DbType.String)]
592			public TestObject Object;
593		}
594
595		[Test]
596		public void UpdateComplexField()
597		{
598			ForEachProvider(db =>
599			{
600				var table = db.GetTable<Table4>();
601				int id = 3;
602				try
603				{
604
605					var obj = new Table4();
606					obj.Object = new TestObject() {Value = 101};
607					obj.Id = id = Convert.ToInt32(db.InsertWithIdentity(obj));
608
609					var obj2 = table.First(_ => _.Id == id);
610					Assert.AreEqual(obj.Object.Value, obj2.Object.Value);
611
612					obj.Object.Value = 999;
613					db.Update(obj);
614
615					obj2 = table.First(_ => _.Id == id);
616					Assert.AreEqual(obj.Object.Value, obj2.Object.Value);
617
618					obj.Object.Value = 666;
619					table
620						.Where(_ => _.Id == id)
621						.Set(_ => _.Object, _ => obj.Object)
622						.Update();
623
624					obj2 = table.First(_ => _.Id == id);
625					Assert.AreEqual(obj.Object.Value, obj2.Object.Value);
626
627					obj.Object.Value = 777;
628					table
629						.Where(_ => _.Id == id)
630						.Set(_ => _.Object, obj.Object)
631						.Update();
632
633					obj2 = table.First(_ => _.Id == id);
634					Assert.AreEqual(obj.Object.Value, obj2.Object.Value);
635
636					var id2 = Convert.ToInt32(table.InsertWithIdentity(() => new Table4
637					{
638						Object = new TestObject() {Value = 300}
639					}));
640
641					obj2 = table.First(_ => _.Id == id2);
642					Assert.AreEqual(300, obj2.Object.Value);
643
644					var id3 = Convert.ToInt32(table.Value(_ => _.Object, () => obj.Object)
645						.InsertWithIdentity());
646
647					obj2 = table.First(_ => _.Id == id3);
648					Assert.AreEqual(obj.Object.Value, obj2.Object.Value);
649
650					var id4 = Convert.ToInt32(table.Value(_ => _.Object, obj.Object)
651						.InsertWithIdentity());
652
653					obj2 = table.First(_ => _.Id == id4);
654					Assert.AreEqual(obj.Object.Value, obj2.Object.Value);
655				}
656				finally
657				{
658					table.Delete(_ => _.Id >= id);
659				}
660			});
661		}
662
663		[TableName("LinqDataTypes")]
664		public class LinqDataTypes3
665		{
666			[PrimaryKey]
667			public int ID;
668			public DateTime  DateTimeValue;
669			public DateTime? DateTimeValue2;
670		}
671
672		[Test]
673		public void Update15()
674		{
675			ForEachProvider(db =>
676			{
677				var table = db.GetTable<LinqDataTypes3>();
678				var date1 = new DateTime(2000, 1, 1);
679				var date2 = new DateTime(2001, 1, 1);
680				var date3 = new DateTime(2002, 1, 1);
681
682				var obj = new LinqDataTypes3()
683				{
684					ID             = 1000,
685					DateTimeValue  = date1,
686					DateTimeValue2 = date1
687				};
688
689				table.Delete(_ => _.ID == obj.ID);
690				db.Insert(obj);
691
692				table
693					.Where(_ => _.ID == obj.ID)
694					.Set(_ => _.DateTimeValue,  date2)
695					.Set(_ => _.DateTimeValue2, date3)
696					.Update();
697
698				var res = table.First(_ => _.ID == obj.ID);
699				Assert.AreEqual(date2, res.DateTimeValue);
700				Assert.AreEqual(date3, res.DateTimeValue2);
701
702				table
703					.Where(_ => _.ID == obj.ID)
704					.Set(_ => _.DateTimeValue,  date3)
705					.Set(_ => _.DateTimeValue2, date2)
706					.Update();
707
708				res = table.First(_ => _.ID == obj.ID);
709				Assert.AreEqual(date3, res.DateTimeValue);
710				Assert.AreEqual(date2, res.DateTimeValue2);
711			});
712		}
713
714		[Test]
715		public void Issue331()
716		{
717			// "OdpManaged" doesn't support XML type
718			ForEachProvider(new[] { "PostgreSQL", ProviderName.OracleManaged }, dc =>
719			{
720				var db = dc as DbManager;
721				if (db == null)
722					return;
723
724				var id = BLToolkit.Common.Convert.ToInt32(db.InsertWithIdentity(new DataTypeTest3()));
725
726				var values = db.GetTable<DataTypeTest3>().ToList();
727
728				db.Update<DataTypeTest3>(values);
729
730				var s = values.First(_ => _.DataTypeID == 2);
731				var o = values.First(_ => _.DataTypeID == id);
732
733				db.MappingSchema.MapObjectToObject(s, o);
734				o.DataTypeID = id;
735
736				Assert.AreEqual(s.String_, o.String_);
737				Assert.AreEqual(s.Decimal_, o.Decimal_);
738
739				db.Update<DataTypeTest3>(values);
740
741				o = db.GetTable<DataTypeTest3>().First(_ => _.DataTypeID == id);
742
743				Assert.AreEqual(s.String_, o.String_);
744				Assert.AreEqual(s.Decimal_, o.Decimal_);
745			});
746		}
747
748	}
749}