Dan Maharry

Some Test-Driven Development Links

by DanM

With the TDD series in full swing - any feedback out there? anyone? - some interesting TDD and coding links have been coming up recently

TDD, XSD and CodeGen, Part 3: Changing Field and Property Names

by DanM

Download all the test and program code generated by the end of this article here.

With a selection of schemas tested and a set of CodeDom tests established for the checks we're most likely to need in part 2, let's turn our attention to the tweaks we want to make to the generated CodeNamespace members. Here's my initial list - we could well add to it later on providing more tests are written to cover the additional code.

  1. Change the field \ property names from elementField\Element to element\Element
  2. Change the type of a field \ property
  3. Change the name of a type 
  4. Change the way dates are serialized.
  5. Change the way boolean values are serialized.

In this post, we'll build the code that makes the first these changes.


TDD, XSD and CodeGen : Part 2, Converting Complex Types and Attributes

by DanM

Download code covering all the tests and code so far from this series here.

In the last episode, we started building our alternate to xsd.exe and wrote a set of five tests that made sure the converter worked against the smallest possible schema. We also learnt about building basic schemas programmatically. Next up, we'll look at some more basic pieces of a schema and start working in the CodeNamespace area.


TDD, XSD and Codegen: Part 1, Simple Tests

by DanM

So let's lay out what we want our application to do.

  • Convert any number of given, connected schema files to a set of C# classes
  • Allow us to tweak aspects of the generated classes to suit our needs elsewhere - for example, change field, property and class names to our own naming conventions or the way something is serialized.
  • Save the generated classes into a given file.
  • Present some sort of UI that allows us to specify what tweaks should be made.
  • Save those settings for reuse later on.

With that in mind, let's bear in mind the mantra of 'code little, think, code a little more' and write some tests. The heart of our app is a two stage process.

  1. Convert schema to namespace
  2. Tweak namespace

So let's start on stage one and write some tests.