示例#1
0
        public void RunTests()
        {
            List <ITestClass> tests = new List <ITestClass>();

            // create the sqlce store (we'll use it to populate sample data)
            SqlCeStoreTest store = new SqlCeStoreTest();

            store.Initialize();
            tests.Add(store);

            Debug.WriteLine(string.Format("Data set has {0} Books and {1} Authors", store.GetBookCount(), store.GetAuthorCount()));

            // uncomment to test truncation
            // store.TruncateBooks();
            // Debug.WriteLine(string.Format("Data set has now has {0} Books", store.GetBookCount()));

            // uncomment to test binary data
            //store.TestBinaryCRUD();

            // uncomment to test serialization
            //store.TestCustomObjectCRUD();

            // uncomment to test enum field handling
            store.TestEnumCRUD();

            TestCascadingInsert(tests);
            TestCascadingUpdates(tests);

            var test = new SqlCeDirectTest();

            test.Initialize();
            tests.Add(test);

            var r = new Random(Environment.TickCount);

            // now run the tests
            TestGetEntityCount(tests);

            TestGetAllBooks(tests);
            TestGetBookById(tests, r.Next(store.LastBookID));
            TestGetBooksByType(tests);

            // get a random author name
            var author = store.GetAuthorById(r.Next(store.LastAuthorID));

            TestGetAuthorByName(tests, author.Name);

            TestGetAuthorsByPage(tests, 10);
        }
示例#2
0
        public void RunTests()
        {
            List<ITestClass> tests = new List<ITestClass>();

            // create the sqlce store (we'll use it to populate sample data)
            SqlCeStoreTest store = new SqlCeStoreTest();
            store.Initialize();
            tests.Add(store);

            Debug.WriteLine(string.Format("Data set has {0} Books and {1} Authors", store.GetBookCount(), store.GetAuthorCount()));

            // uncomment to test truncation
            // store.TruncateBooks();
            // Debug.WriteLine(string.Format("Data set has now has {0} Books", store.GetBookCount()));

            // uncomment to test binary data
            //store.TestBinaryCRUD();

            // uncomment to test serialization
            //store.TestCustomObjectCRUD();

            // uncomment to test enum field handling
            store.TestEnumCRUD();

            TestCascadingInsert(tests);
            TestCascadingUpdates(tests);

            var test = new SqlCeDirectTest();
            test.Initialize();
            tests.Add(test);

            var r = new Random(Environment.TickCount);

            // now run the tests
            TestGetEntityCount(tests);

            TestGetAllBooks(tests);
            TestGetBookById(tests, r.Next(store.LastBookID));
            TestGetBooksByType(tests);

            // get a random author name
            var author = store.GetAuthorById(r.Next(store.LastAuthorID));

            TestGetAuthorByName(tests, author.Name);

            TestGetAuthorsByPage(tests, 10);
        }