Print Page | Close Window

Unit Testing and XML serialization

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1688
Printed Date: 19-Sep-2025 at 11:48pm


Topic: Unit Testing and XML serialization
Posted By: downeytim
Subject: Unit Testing and XML serialization
Date Posted: 16-Mar-2010 at 6:10am
Is there any way to create an XML file that contains entities to be used to load the EntityManager with and run unit tests.  We want to create a "mock" situation where we can run unit tests without have a DB present.  We want to create an XML file that contains the data for the tests, load it into a disconnected EntityManager, run our tests and check the results.
 
 



Replies:
Posted By: ting
Date Posted: 07-Apr-2010 at 5:56pm
Tim,
 
Yes, one of our customers did exactly this when developing the UFC Gyms Touch App and performed development and testing without the database. 
  1. First, you need to get some sample entities.  Either query them from a real database or alternatively, create new entities, set their properties, and add them to the EntityManager.
  2. Second, save the EntityManager's cache to a file by calling EntityManager.CacheStateManager.SaveCacheState().
  3. Now you can load the cache using RestoreCacheState() and operate fully disconnected from the database.
 
 



Print Page | Close Window