public void FieldUpdateTriggers() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); AddDateTimeField(tran); AddReferenceField(tran); try { PKInt32 o = PKInt32.GetRef(7777777); o[IntField] = 42; string expected = TriggerText(IntField, null, 42); o[DateTimeField] = new DateTime(2014, 10, 28); expected += TriggerText(DateTimeField, null, new DateTime(2014, 10, 28)); o[ReferenceField] = Contact.Ed; expected += TriggerText(ReferenceField, null, Contact.Ed); Assert.AreEqual(expected, o.triggersText); } finally { Remove(ReferenceField, tran); Remove(DateTimeField, tran); Remove(IntField, tran); } } }
public void IndexerSetDynamic() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); AddDateTimeField(tran); AddReferenceField(tran); try { PKInt32.GetRef(7777777)[IntField] = 42; PKInt32.GetRef(7777777)[DateTimeField] = new DateTime(2014, 10, 28); PKInt32.GetRef(7777777)[ReferenceField] = Contact.Ed; object value = PKInt32.GetRef(7777777)[IntField]; Assert.AreEqual(42, value); value = PKInt32.GetRef(7777777)[DateTimeField]; Assert.AreEqual(new DateTime(2014, 10, 28), value); value = PKInt32.GetRef(7777777)[ReferenceField]; Assert.AreEqual(Contact.Ed, value); } finally { Remove(ReferenceField, tran); Remove(DateTimeField, tran); Remove(IntField, tran); } } }
public void IndexerGetDynamic() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); AddDateTimeField(tran); AddReferenceField(tran); try { object value = PKInt32.GetRef(7777777)[IntField]; Assert.IsNull(value); value = PKInt32.GetRef(7777777)[DateTimeField]; Assert.IsNull(value); value = PKInt32.GetRef(7777777)[ReferenceField]; Assert.IsNull(value); } finally { Remove(ReferenceField, tran); Remove(DateTimeField, tran); Remove(IntField, tran); } } }
public void IndexerTypeCheckReference() { using (SoodaTransaction tran = new SoodaTransaction()) { AddReferenceField(tran); try { PKInt32.GetRef(7777777)[ReferenceField] = PKInt32.GetRef(7777777); } finally { Remove(ReferenceField, tran); } } }
public void IndexerTypeCheck() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); try { PKInt32.GetRef(7777777)[IntField] = "invalid"; } finally { Remove(IntField, tran); } } }
public void DynamicGetDynamic() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); try { dynamic d = PKInt32.GetRef(7777777); object value = d.IntDynamicField; Assert.IsNull(value); } finally { Remove(IntField, tran); } } }
public void SelectDynamic() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); try { PKInt32.GetRef(7777778)[IntField] = 42; IEnumerable <object> oe = PKInt32.Linq().Select(p => p[IntField]); CollectionAssert.AreEquivalent(new object[] { null, 42, null }, oe); } finally { Remove(IntField, tran); } } }
public void WhereDynamicUpdate() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); try { PKInt32.GetRef(7777777)[IntField] = 42; IEnumerable <PKInt32> pe = PKInt32.Linq().Where(p => (int)p[IntField] == 5); CollectionAssert.IsEmpty(pe); pe = PKInt32.Linq().Where(p => (int)p[IntField] == 42); CollectionAssert.AreEquivalent(new PKInt32[] { PKInt32.GetRef(7777777) }, pe); } finally { Remove(IntField, tran); } } }