Jeremy Miller asked  earlier today. And then I wrote the following test which covers I found a while ago. It's incomplete, but then I started worrying, is this approach right? I'm testing one method which takes a schema and returns a CodeNamespace which has been altered. I need to make sure the result addresses the bug that was discovered which this test seems to do. But is it a unit test? Shouldn't it have fewer asserts as I've read in the past? Shouldn't I be satisfied with the tests I've also written on routines that perform the tweaking on the CodeNamespace once it has been generated, but which do not make sure that all those smaller routines work together to produce the overall result? What are your thoughts out there.

[Test]
public void Convert_ComplexTypeHasElementInChoiceWithNoType_GeneratedCodeFixesTypeOfObjectBug()
{
    XmlSchema schema = sb.CreateSchemaContaining(new XmlSchemaObject[] {
        sb.RootElementWithSeparateType(rootElementName, rootTypeName),
        sb.NamedComplexTypeContaining(rootTypeName, 
           sb.ChoiceOf(sb.DateStringAndEmptyElements(dateElementName, stringElementName, emptyElementName)))
    });

    //Convert it
    CodeNamespace ns = sc.ConvertSchemaToCodeNamespace(schema);

    //Check that the empty class has been generated
    CodeDomAssert.AssertClassExists(ns, emptyElementName + "Class");

    //Find the original class and check it has a choice element in it 
    //which isn't typeof(object) but which is typeof(emptyElementClass)

    foreach (CodeTypeDeclaration typeDec in ns.Types)
    {
        if (typeDec.Name == rootTypeName)
        {
            //Check that the choice element is fielded by a property of type system object tagged with
            //[System.Xml.Serialization.XmlElementAttribute("emptyElement", typeof(emptyElementClass))]

            //Create attributes to check
            CustomAttribute emptyElementAttribute = new CustomAttribute(
            CustomAttributeType.Simple, elementAttributeName,
            new AttributeArgument[] {
               new AttributeArgument(CustomArgumentType.Simple, String.Empty, emptyElementName),
               new AttributeArgument(CustomArgumentType.TypeOf, String.Empty,  emptyElementName + "Class")
            });

            CodeDomAssert.AssertFieldExists(typeDec.Members, MemberAttributes.Private, "System.Object",
            HelperFunctions.DefaultXsdGeneratedFieldName(defaultGeneratedPropertyName));

            CodeDomAssert.AssertTaggedPropertyExists(typeDec.Members, defaultGeneratedPropertyName, "System.Object",
            true, true, HelperFunctions.DefaultXsdGeneratedFieldName(defaultGeneratedPropertyName),
            new CustomAttribute[] { emptyElementAttribute });
        }
    }
}