コード例 #1
0
        private static void ResetStoreData()
        {
            using (StoreContext storeContext = new StoreContext())
            {
                storeContext.MakeSureDatabaseExistsAndReady();

                var payloadRecords = storeContext.PayloadRecords.Where(i => true).ToArray();
                storeContext.RemoveRange(payloadRecords);

                var destinations = storeContext.Destinations.Where(i => true).ToArray();
                storeContext.RemoveRange(destinations);

                storeContext.SaveChanges();
            }

            using (StoreContext storeContext = new StoreContext())
            {
                Assert.AreEqual(0, storeContext.PayloadRecords.Count());
                Assert.AreEqual(0, storeContext.Destinations.Count());
            }
        }