New Posts New Posts RSS Feed: Unit Testing and XML serialization
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Unit Testing and XML serialization

 Post Reply Post Reply
Author
downeytim View Drop Down
Newbie
Newbie


Joined: 08-Dec-2009
Location: Dallas, Texas
Posts: 18
Post Options Post Options   Quote downeytim Quote  Post ReplyReply Direct Link To This Post Topic: Unit Testing and XML serialization
    Posted: 16-Mar-2010 at 6:11am
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.
Back to Top
downeytim View Drop Down
Newbie
Newbie


Joined: 08-Dec-2009
Location: Dallas, Texas
Posts: 18
Post Options Post Options   Quote downeytim Quote  Post ReplyReply Direct Link To This Post Posted: 16-Mar-2010 at 11:45am
Some additonal data on this.
 
I have been able to serialize OUT to XML an instance of one of my Entity based classes.  But the Deserialization fails with a Null Object Reference.  Below is the exception. It looks like it is failing trying to find the EntityGroup for the object being created.  Yet where was no group when it was serialized.  It was created in code without an entity manager or group
 
IdeaBlade.EntityModel.EntityWrapper.get_EntityGroup()
IdeaBlade.EntityModel.EntityWrapper.get_EntityManager()
IdeaBlade.EntityModel.EntityWrapper.get_VerifierEngine()
SetValueWithVerification(DataEntityPropertySetInterceptorArgs`2 setterArgs)
b__4(DataEntityPropertySetInterceptorArgs`2 args)
HandleAction(Action`1 action, TArgs args)
b__3(TArgs args)
ExecuteActions(TArgs args)
SetValue(TInstance instance, Object context, TValue value)
SetValue(TInstance instance, TValue value)
SetValue(TInstance instance, TValue value)
CSS.Data.Test.TestClass.set_Name(String value) in C:\Dev\Cypress\Cypress.Framework\Main\CSS.Data\CSS.Data.Test\UnitTest1.cs: line 281
ReadTestClassFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)
System.Runtime.Serialization.XmlObjectSerializer.ReadObject(Stream stream)
CSS.Data.Test.UnitTest1.DeserializeBusObject[T](String filename, T& entity) in C:\Dev\Cypress\Cypress.Framework\Main\CSS.Data\CSS.Data.Test\UnitTest1.cs: line 211
CSS.Data.Test.UnitTest1.LoadTestClassFromXmlTest() in C:\Dev\Cypress\Cypress.Framework\Main\CSS.Data\CSS.Data.Test\UnitTest1.cs: line 186
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down