---
title: "Introducing the Osherove.Interception framework"
url: "https://osherove.com/blog/2004/10/12/introducing-the-osheroveinterception-framework.md"
canonical: "https://osherove.com/blog/2004/10/12/introducing-the-osheroveinterception-framework.html"
published: "2004-10-12T04:17:00"
updated: "2004-10-12T04:17:00"
tags: [".Net Original"]
author: "Roy Osherove"
description: "Following the Nunit Extensibility framework , I did some thinking and made a More generic framework for interception ability. That means that you can create your own interception attributes not only for unit testing but…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Introducing the Osherove.Interception framework

By Roy Osherove October 12, 2004 In [.Net Original](https://osherove.com/blog/category/net-original)

**Historical article** · Originally published October 12, 2004; technical details may be outdated.

Following the [Nunit Extensibility framework](https://weblogs.asp.net/rosherove/archive/2004/10/05/238201.aspx), I did some thinking and made a More generic framework for interception ability. That means that you can create your own interception attributes not only for unit testing but for real world applications as well.

the new solution consists of more real world examples (well, one, but a cool one).

The coolest example so far is an idea triggered by [Peli](http://blog.dotnetwiki.org/) \- it's a Caching attribute.

In this case I created an object that has properties and methods that have an \[AutoCache\] attribute on them.

this makes them automatically return values from a simple cache object.

Actually - the attribute takes care of everything so the properties and methods actually return NULL.

Yep - it magically just works.

Give it a shot. I like this idea and I think it might have a future.

what do you think?

**Download:**

[http://teamagile.com/downloads/TeamAgile.ApplicationBlocks.Interception.zip](http://teamagile.com/downloads/TeamAgile.ApplicationBlocks.Interception.zip)

Example:

public class MyDataObject:CachedPropertyBag

{

      \[AutoCached("CustomerList")\]

      public string\[\] GetCustomerList()

      {

         //the beauty here is that any callers to this method will actually

         //get a string array with 3 items in it.

         //can you say "automagically", boys and girls?

            return null;

      }

}

## More in .Net Original

[All posts in .Net Original](https://osherove.com/blog/category/net-original)

- Oct 15, 2004

    ### [Solving Team Development with web projects hell](https://osherove.com/blog/2004/10/15/solving-team-development-with-web-projects-hell.html)

- Oct 15, 2004

    ### [\[Tools and Addins\] : SharpTools, web controls and various utilities - free!](https://osherove.com/blog/2004/10/15/tools-and-addins-sharptools-web-controls-and-various-utiliti.html)

- Oct 12, 2004

    ### [\[Rediscovered\] Advanced debugging tips and stuff you never knew about the "Find" combo box](https://osherove.com/blog/2004/10/12/rediscovered-advanced-debugging-tips-and-stuff-you-never-kne.html)

- Oct 5, 2004

    ### [Introducing: XtUnit . An Unofficial Unit Testing Extensibility Framework - Add new attributes to NUnit or MbUnit easily!](https://osherove.com/blog/2004/10/5/introducing-xtunit-an-unofficial-unit-testing-extensibility.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
