Contents tagged with ASP.NET

  • Tagging a fake Orchard content item

    In my series of posts about building fake Orchard content items for testing purposes, here’s a short one that shows how to add tags to a fake content item. This one is interesting because it shows a basic case of relationship (between the item and its tags). The way tags have been implemented (it’s one of the oldest modules in Orchard, and one that should honestly be replaced with taxonomies in almost all cases), in order to add tags, we’ll need to create records for each:

    Read more...

  • Stubbing the Orchard content manager

    I’ve shown in the previous post how to build fake content items for testing purposes. When the code being tested gets content items from the content manager, however, you will also need a stub for the content manager, so your code receives fake content items that you have prepared, and not real ones from the database.

    Read more...

  • Faking Orchard content items for testing

    When testing Orchard modules, it’s often necessary to build fake content items that will be usable by your code, but won’t be database-bound. For this purpose, I’ve built a number of stubs and helpers over the years that enable most scenarios to work using fake content items. Because everything in Orchard is based off interfaces and dependency injection, mocking is rarely necessary, and a few good stubs are often all you need.

    Read more...

  • Unit tests are to testing…

    Developing good software at a large scale requires the collaboration of several disciplines, that are not, contrary to your boss’ opinion, interchangeable. You need developers, of course, but you also need designers, PMs, QA, writers, usability people, localization, pointy-haired bosses, etc. There has been a tendency in some companies, however, to try to get developers to do more and more beyond coding, or even to magically transform test engineers into developers.

    Read more...

  • My TechEd Europe talk on Orchard is online

    I spent a lot of time on planes last week (which explains why I haven’t posted anything), on my way to Barcelona, where Microsoft had invited me to talk on the .NET Open Source Showcase. It was a great experience and opportunity, and I hope I did justice to Orchard in the time I had to present it. I focused on what makes Orchard a success story, and how to reproduce that success on other open source projects.

    Read more...

  • For the love of OCD, show whitespace in your IDE

    It’s a simple thing, and it will make it immediately obvious when one of your files contains accidental indentation tabs instead of the spaces that should replace them, or trailing spaces. All IDE and code editors have an option to show whitespace. I always have it enabled. The subtle glyphs that will materialize the spaces and tabs are hardly noticeable while you’re working, except when something unusual is where it shouldn’t be:Trailing spaces and tabs are immediately obvious.

    Read more...

  • Identity in Orchard Import/Export

    Orchard has a really neat concept of identity that’s mainly used when importing contents into the CMS. One of the difficulties with importing contents is that you need to make sure that you can import not just new items, but also updates to existing items. For this to work consistently, we need to be able to identify a content item reliably.

    Read more...

  • Opting out of anti-forgery validation in Orchard

    Anti-forgery tokens are a very important security feature of ASP.NET MVC and Orchard. Most of the time, you should keep them in place, and just let the system work its magic. There are a few rare situations however where it’s not the appropriate protection and you’ll want to disable it. Being too lazy to include the token in your ajax requests or your forms is of course not one of those situations.

    Read more...