• Unit Test Best practices

    • Arrange test in your solution

      It is common pratice to have a test class per tested class, a test rpoject per tested project and at lest one test method per tested method.

    • Naming tests: [MethodUnderTest]_[Scenario]_[ExpectedBehavior]
    • Use [Setup] and [TearDown] attributes to reuse code in your tests such as creating and initializing common objects all your tests use.
    • Don’t use [Setup] and [TearDown] to initialize or destroy objects which are not shared throughout the test class in all the tests, as it makes the tests less understandable (the reader won’t know which tests use the setup method and which don’t).
  • Value object and Persistance

    It is confusing to mixed value object with its persistence. We know value has has no identity. How about primary key in database. Every table in database has an primary key. Isn't that key the identity of value object if we want to persist the value object to database? Here we mix the domain model with the persistence.

  • What is the cost of catching an exception

    We all known that following an exception without using it is quite silly. How does it really hurt performance. It turns out that difference is very small.

  • The order of route is important in asp.net mvc

    I have try to add route to reroute the default.aspx to home handler.

  • XSLT note - xsl:output method

    There are 3 method option in xsl:output element, xml, html, text. only xml option will output xml declaration. only text will disables output escaping. In your style sheet, you want to export < , text will output "<", but xml and html will output <