1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 using NUnit
.Framework
;
19 namespace Castle
.DynamicProxy
.Test
22 public class DiamondProblem
24 public interface IFirst
26 void OriginalMethod1();
27 void OriginalMethod2();
29 public class FirstImpl
: IFirst
32 public void OriginalMethod1() { }
34 public virtual void OriginalMethod2() { }
36 public interface ISecond
: IFirst
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
);