Ejemplo n.º 1
0
        public static void InsertThenDelete_TypedRow(ICrudDataStore store)
        {
            for (var i = 0; i < 10; i++)
            {
                store.Insert(new Patient
                {
                    SSN        = i.ToString(),
                    First_Name = "Jack",
                    Last_Name  = "Kozloff_" + i,
                    DOB        = new DateTime(1980, 1, 12)
                });
            }

            var result = store.Load(new Query("CRUD.Queries.Patient.List", typeof(Patient))
            {
                new Query.Param("LN", "%loff_5")
            })[0];

            Aver.AreEqual(1, result.Count);
            var row = result[0] as Patient;

            Aver.AreEqual("5", row.SSN.Trim());

            store.Delete(row);

            result = store.Load(new Query("CRUD.Queries.Patient.List", typeof(Patient))
            {
                new Query.Param("LN", "%loff_5")
            })[0];
            Aver.AreEqual(0, result.Count);

            result = store.Load(new Query("CRUD.Queries.Patient.List", typeof(Patient))
            {
                new Query.Param("LN", "%loff_%")
            })[0];
            Aver.AreEqual(9, result.Count);
        }