public void WhereDynamicReference() { using (SoodaTransaction tran = new SoodaTransaction()) { AddReferenceField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; o[ReferenceField] = Contact.Mary; IEnumerable <PKInt32> pe = PKInt32.Linq().Where(p => ((Contact)p[ReferenceField]).LastSalary.Value == 42); CollectionAssert.IsEmpty(pe); pe = PKInt32.Linq().Where(p => ((Contact)p[ReferenceField]).LastSalary.Value == 123.123456789M); CollectionAssert.AreEquivalent(new PKInt32[] { o }, pe); pe = PKInt32.Linq().Where(p => ((Contact)p[ReferenceField]).GetLabel(false) == "Mary Manager"); CollectionAssert.AreEquivalent(new PKInt32[] { o }, pe); } finally { o.MarkForDelete(); Remove(ReferenceField, tran); } } }
public void NonNullReference() { using (SoodaTransaction tran = new SoodaTransaction()) { AddReferenceField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; tran.Commit(); } finally { o.MarkForDelete(); Remove(ReferenceField, tran); } } }
public void NonNullString() { using (SoodaTransaction tran = new SoodaTransaction()) { AddStringField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; Assert.AreEqual("", o[StringField]); } finally { o.MarkForDelete(); Remove(StringField, tran); } } }
public void DontInsertNull() { using (SoodaTransaction tran = new SoodaTransaction()) { AddDateTimeField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; tran.SaveObjectChanges(); object count = ExecuteScalar(tran, "select count(*) from PKInt32 where id={0}", o.Id); Assert.AreEqual(1, count); count = ExecuteScalar(tran, "select count(*) from PKInt32_" + DateTimeField + " where id={0}", o.Id); Assert.AreEqual(0, count); } finally { o.MarkForDelete(); Remove(DateTimeField, tran); } } }
public void SoqlWrapperDynamicInsert() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; o[IntField] = 42; PKInt32List pl = PKInt32.GetList(new SoqlInt32WrapperExpression(new SoqlPathExpression(IntField)) == 5); CollectionAssert.IsEmpty(pl); pl = PKInt32.GetList(new SoqlInt32WrapperExpression(new SoqlPathExpression(IntField)) == 42); CollectionAssert.AreEquivalent(new PKInt32[] { o }, pl); } finally { o.MarkForDelete(); Remove(IntField, tran); } } }
public void SoqlDynamicInsert() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; o[IntField] = 42; PKInt32List pl = PKInt32.GetList(new SoqlBooleanRelationalExpression(new SoqlPathExpression(IntField), new SoqlLiteralExpression(5), SoqlRelationalOperator.Equal)); CollectionAssert.IsEmpty(pl); pl = PKInt32.GetList(new SoqlBooleanRelationalExpression(new SoqlPathExpression(IntField), new SoqlLiteralExpression(42), SoqlRelationalOperator.Equal)); CollectionAssert.AreEquivalent(new PKInt32[] { o }, pl); } finally { o.MarkForDelete(); Remove(IntField, tran); } } }
public void SoodaWhereClauseDynamicInsert() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; o[IntField] = 42; PKInt32List pl = PKInt32.GetList(new SoodaWhereClause("IntDynamicField = 5")); CollectionAssert.IsEmpty(pl); pl = PKInt32.GetList(new SoodaWhereClause("IntDynamicField = 42")); CollectionAssert.AreEquivalent(new PKInt32[] { o }, pl); } finally { o.MarkForDelete(); Remove(IntField, tran); } } }
public void WhereDynamicInsert() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; o[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[] { o }, pe); } finally { o.MarkForDelete(); Remove(IntField, tran); } } }