EntityState XML has the simplicity of being an easily constructed XML document which may either be written by hand (e.g. <Entity1><Field1>5</Field1><Field2>10</Field2></Entity1>) or XML serialized using end-users’ own classes.
TestScenario is a more complicated structure which can only be generated by using XmlSerializer on the RuleSessionState class. (RuleSession.State)
The advantages of the TestScenario are:
- It includes temporary state fields and collections which are used for both temporary state, and also cross-schema linked Entities and Collections.
- It will work with object-bound schemas that only work with the BinaryFormatter and not the XmlSerializer.
- It will support circular references.
EntityState XML may still be used to some degree for temporary fields via a collection of the DataStateMappingDef instances. This is restricted to:
- Root-level temporary linked Entity fields.
- Independent RuleSet Entity arguments.
Note - In most testing situations, it is suitable for the user to utilize testscenarios unless the state data must be consumed or deserialized by a separate application.