Simple impl to MockRailsEngineContext.Url
[castle.git] / Tools / DynamicProxy / Castle.DynamicProxy.Tests / DiamondProblem.cs
blobe61f51816dd8c3bb9f9c500e450c105db42a008e
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 using System;
16 using System.Text;
17 using NUnit.Framework;
19 namespace Castle.DynamicProxy.Test
21 [TestFixture]
22 public class DiamondProblem
24 public interface IFirst
26 void OriginalMethod1();
27 void OriginalMethod2();
29 public class FirstImpl : IFirst
31 // NON-virtual method
32 public void OriginalMethod1() { }
33 // VIRTUAL method
34 public virtual void OriginalMethod2() { }
36 public interface ISecond : IFirst
38 void ExtraMethod();
41 [Test]
42 public void CreateProxyOfTypeWithMixinCausingDiamondWhenMethodIsNonVirtual()
44 ProxyGenerator generator = new ProxyGenerator();
45 object proxy = generator.CreateClassProxy(typeof(FirstImpl), new Type[]{typeof(ISecond)},
46 new StandardInterceptor(), false);
47 Assert.IsTrue(proxy is FirstImpl);
48 Assert.IsTrue(proxy is IFirst);
49 Assert.IsTrue(proxy is ISecond);