[RollBackAttribute2]
Any reason why this isn't [RollBack2Attribute] or [RollBack2] ?
Jamie.
On 12/21/06, Andrew Stopford <[EMAIL PROTECTED]> wrote:
Hi Folks,
As of MbUnit 2.4.112 the code from Cathal Connolly and Todd Menier for a
rollback using .NET 2.0 has been included in the MbUnit.Framework.2.0
assembly.
As MbUnit.Framework.1.1 will be folded into MbUnit.Framework to make use of
this you will need to referance the MbUnit.Framework.2.0 assembly and use
using MbUnit.Framework
and then
[RollBackAttribute2]
pivate void TestSomething()
rather than
[RollBackAttribute]
pivate void TestSomething()
Andy
On 12/1/06, toddm <[EMAIL PROTECTED]> wrote:
>
> Thanks cathal, this works great, and is a much-needed update! I took
> what you did and was able to reduce the code quite a bit, so I thought
> I'd share. This should be functionally equivalant:
>
>
> [AttributeUsage(AttributeTargets.Method, AllowMultiple =
> false, Inherited = true)]
> public sealed class RollBackAttribute : DecoratorPatternAttribute
> {
> public override IRunInvoker GetInvoker(IRunInvoker invoker)
> {
> return new RollBackRunInvoker(invoker);
> }
>
> private class RollBackRunInvoker : DecoratorRunInvoker
> {
> public RollBackRunInvoker(IRunInvoker invoker) :
base(invoker) {}
>
> public override object Execute(object o, IList args)
> {
> using (TransactionScope scope = new
> TransactionScope(TransactionScopeOption.RequiresNew))
> {
> return base.Invoker.Execute(o, args);
> }
> }
> }
> }
>
>
> > >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---