Wednesday, December 2, 2009

Lets do BDD with MSpec and WorldCreator2

WorldCreator module is an excellent module and can provide dynamic types through a UI without a need of a user that knows coding. But since we all know coding I thought I move on and write some specs for WorldCreator2 .

My first thoughts are to drop the reflection emit approach and go with the codedom one and support templating and scripting . So I have defined the following model

image

and wrote 50 specs, which i am posting bellow and invite all of you to comment , suggest enhance them

PersistentClassInfo Initialization, When initializing a Persis

tentClassInfo and default template exists
» should assign that template to classInfo

PersistentClassInfo Initialization, When initializing a PersistentClassInfo
» should create a default classInfo template if not exists
» should set template as default

PersistentClassInfo Initialization, When initializing a PersistentClassInfo and default template exists
» should assign that template to classInfo

PersistentClassInfo Initialization, When initializing a PersistentClassInfo
» should create a default classInfo template if not exists
» should set template as default

CompileEngine, When cannot compile a dynamic module
» should swallow exception
» should delegate any errors to assembly info compile errors property

CompileEngine specs, When compiling a dynamic assembly
» should not contain any compilation error
» should Create A Dynamic module

CompileEngine specs, When compiling class with members
» should have no compile errors
» should generate class type
» should have those members as proeprties

CompileEngine specs, When PersistentClassInfo BaseType Belongs to different assemmbly
» should compile with no errors
» should create a baseType descenant class

ExistentTypesMemberCreator, When Creating ExistentTypes CoreMembers that exist already
» should not throw any exceptions

ExistentTypesMemberCreator, When Creating ExistentTypes CoreMembers
» should find that member through xpdictionary
» should create typedattributes

ExistentTypesMemberCreator, When Creating ExistentTypes ReferenceMembers
» should find that member through xpdictionary
» should create typedattributes

ExistentTypesMemberCreator, When Creating ExistentTypes CollectionMembers
» should find that member through xpdictionary
» should create typedattributes

CodeTemplate, When changing template type of a CodeTemplate
» should find all default template usings from module resources and display them
» should find all default template from module resources and display them

PersistentTypeInfo, When peristent type code template change
» should delegate all props from code template to persistent type templateinfo object

PersistentTypeInfo Creation, When A persistentTypeInfo object is creating
» should initialize its template

PersistentTypeInfo, When Saving PersistentTypes
» should persist the referenceType
» should generate the class code

PersistentTypeInfo, When Deleting PersistentTypes
» should delete TemplateInfo as well

CodeEngine, When generating code from persistentMemberInfo
» should have memberInfo attributes generated

CodeEngine, When generating code from persistentClassinfo with no base type defined
» should use default Base type

CodeEngine, When generating code from persistentClassinfo
» should inject usings from all members into template usings section
» should inject usings from classinfo templateinfo into template usings section
» should inject code from all members in classinfo generated code
» should have class type typeattributes generated
» should have propertytype typeattributes generated
» should replace CLASSNAME with persistentClassInfo name
» should replace BASECLASSNAME with persistentClassInfo name
» should add all interfaces after baseclassName
» should replace PROPERTYNAME with persistentClassInfo name
» should replace PROPERTYTYPE with persistentClassInfo type

PersistentMemberInfo Initialization, When initializing a PersistentMemberInfo and default template exists
» should assign that template to classInfo

PersistentMemberInfo Initialization, When initializing a PersistentMemberInfo
» should create a default classInfo template if not exists

PersistentMemberInfo, When saving a memberinfo associated with classInfo
» should generate code for the memberInfo
» should generate associate classinfo generatedcode

XpoObjectMerger, When Merging Dynamic Types
» should call an update sql statement
» should create an ObjectType Column to Parent if parent has no records

WorldCreatorModule, When dynamic module cannot be created
» should save errors in persistent assembly info

WorldCreatorModule, When Settingup Module
» should contain dynamic modules within Application Modules collection
» should not load modelDiffs from dynamic assemblies (NOT IMPLEMENTED)
» should create Existent Classes Member

WorldCreatorModule, When Updating Model
» should display owner column to extended members list view
» should remove dynamic assemblies from Assemblies image Node

WorldCreatorModule, When Application Setup Is Completed
» should merge any mergable dynamic type

InterfaceInfo, When linking with a PersistentInterfaceInfo
» should create all missing persistent member infos

When creating members from interfaceinfo with collection members
» should throw exception

When creating members from interfaceinfo
» should create all missing core type persistent member infos (FAIL)
» should create all missing reference member infos (FAIL)

Xaf TypesInfo, When loading types from Dynamic Assemblies
» should not load all types

PersistentAttributeInfo, When saving ClassInfo attribute
» should generate code for the referenced class info (FAIL)

PersistentAttributeInfo, When saving memberInfo attribute
» should generate code for the referenced class info (FAIL)

» should swallow exception
» should delegate any errors to assembly info compile errors property

CompileEngine specs, When compiling a dynamic assembly
» should not contain any compilation error
» should Create A Dynamic module

CompileEngine specs, When compiling class with members
» should have no compile errors
» should generate class type
» should have those members as proeprties

CompileEngine specs, When PersistentClassInfo BaseType Belongs to different assemmbly
» should compile with no errors
» should create a baseType descenant class

ExistentTypesMemberCreator, When Creating ExistentTypes CoreMembers that exist already
» should not throw any exceptions

ExistentTypesMemberCreator, When Creating ExistentTypes CoreMembers
» should find that member through xpdictionary
» should create typedattributes

ExistentTypesMemberCreator, When Creating ExistentTypes ReferenceMembers
» should find that member through xpdictionary
» should create typedattributes

ExistentTypesMemberCreator, When Creating ExistentTypes CollectionMembers
» should find that member through xpdictionary
» should create typedattributes

CodeTemplate, When changing template type of a CodeTemplate
» should find all default template usings from module resources and display them
» should find all default template from module resources and display them

PersistentTypeInfo, When peristent type code template change
» should delegate all props from code template to persistent type templateinfo object

PersistentTypeInfo Creation, When A persistentTypeInfo object is creating
» should initialize its template

PersistentTypeInfo, When Saving PersistentTypes
» should persist the referenceType
» should generate the class code

PersistentTypeInfo, When Deleting PersistentTypes
» should delete TemplateInfo as well

CodeEngine, When generating code from persistentMemberInfo
» should have memberInfo attributes generated

CodeEngine, When generating code from persistentClassinfo with no base type defined
» should use default Base type

CodeEngine, When generating code from persistentClassinfo
» should inject usings from all members into template usings section
» should inject usings from classinfo templateinfo into template usings section
» should inject code from all members in classinfo generated code
» should have class type typeattributes generated
» should have propertytype typeattributes generated
» should replace CLASSNAME with persistentClassInfo name
» should replace BASECLASSNAME with persistentClassInfo name
» should add all interfaces after baseclassName
» should replace PROPERTYNAME with persistentClassInfo name
» should replace PROPERTYTYPE with persistentClassInfo type

PersistentMemberInfo Initialization, When initializing a PersistentMemberInfo and default template exists
» should assign that template to classInfo

PersistentMemberInfo Initialization, When initializing a PersistentMemberInfo
» should create a default classInfo template if not exists

PersistentMemberInfo, When saving a memberinfo associated with classInfo
» should generate code for the memberInfo
» should generate associate classinfo generatedcode

XpoObjectMerger, When Merging Dynamic Types
» should call an update sql statement
» should create an ObjectType Column to Parent if parent has no records

WorldCreatorModule, When dynamic module cannot be created
» should save errors in persistent assembly info

WorldCreatorModule, When Settingup Module
» should contain dynamic modules within Application Modules collection
» should not load modelDiffs from dynamic assemblies (NOT IMPLEMENTED)
» should create Existent Classes Member

WorldCreatorModule, When Updating Model
» should display owner column to extended members list view
» should remove dynamic assemblies from Assemblies image Node

WorldCreatorModule, When Application Setup Is Completed
» should merge any mergable dynamic type

InterfaceInfo, When linking with a PersistentInterfaceInfo
» should create all missing persistent member infos

When creating members from interfaceinfo with collection members
» should throw exception

When creating members from interfaceinfo
» should create all missing core type persistent member infos (FAIL)
» should create all missing reference member infos (FAIL)

Xaf TypesInfo, When loading types from Dynamic Assemblies
» should not load all types

PersistentAttributeInfo, When saving ClassInfo attribute
» should generate code for the referenced class info (FAIL)

PersistentAttributeInfo, When saving memberInfo attribute
» should generate code for the referenced class info (FAIL)

Technorati Tags: ,,

Subscribe to XAF feed
Subscribe to community feed

DiggIt!
blog comments powered by Disqus