├── .gitattributes ├── src ├── Castle.Core.Tests │ ├── Core.Tests │ │ └── Resource │ │ │ ├── file1.txt │ │ │ └── MoreRes │ │ │ └── file2.txt │ ├── Program.cs │ ├── DynamicProxy.Tests │ │ ├── Classes │ │ │ ├── EmptyClass.cs │ │ │ ├── SimpleClass.cs │ │ │ ├── HasFinalizer.cs │ │ │ ├── Component2.cs │ │ │ ├── AbstractClassWithMethod.cs │ │ │ ├── VirtualClassWithAutoProperty.cs │ │ │ ├── HasVirtualStringAutoProperty.cs │ │ │ ├── ClassWithCharRetType.cs │ │ │ ├── ClassWithIndexer.cs │ │ │ ├── VirtualClassWithMethod.cs │ │ │ ├── HasCtorWithParamsArgument.cs │ │ │ ├── HasCtorWithParamsStrings.cs │ │ │ ├── ClassWithVirtualInterface.cs │ │ │ ├── IHasNonInheritableAttributeWithArray.cs │ │ │ ├── IHasNonInheritableAttributeWithArray2.cs │ │ │ ├── VirtualClassWithPublicField.cs │ │ │ ├── VirtuallyImplementsInterfaceWithProperty.cs │ │ │ ├── HasCtorWithIntAndParamsArgument.cs │ │ │ ├── InheritsAbstractClassWithMethod.cs │ │ │ ├── NonPublicMethodsClass.cs │ │ │ ├── ClassWithInterface.cs │ │ │ ├── InheritableAttribute.cs │ │ │ ├── HasTwoProtectedMethods.cs │ │ │ ├── NonInheritableAttribute.cs │ │ │ ├── ClassWithAttributesOnConstructorParameters.cs │ │ │ ├── VirtuallyImplementsInterfaceWithEvent.cs │ │ │ ├── NonInheritableWithArray2Attribute.cs │ │ │ ├── NonInheritableWithArrayAttribute.cs │ │ │ ├── ClassCallingVirtualMethodFromCtor.cs │ │ │ ├── NestedNonInheritableAttribute.cs │ │ │ ├── VirtualClassWithNoDefaultCtor.cs │ │ │ ├── ClassWithExplicitInterface.cs │ │ │ ├── NonPublicConstructorClass.cs │ │ │ ├── ClassToSerialize.cs │ │ │ └── ClassWithDefaultConstructor.cs │ │ ├── Records │ │ │ ├── EmptyRecord.cs │ │ │ ├── EmptyGenericRecord.cs │ │ │ ├── DerivedFromEmptyRecord.cs │ │ │ └── DerivedFromEmptyGenericRecord.cs │ │ ├── Interfaces │ │ │ ├── IBase.cs │ │ │ ├── IOne.cs │ │ │ ├── ITwo.cs │ │ │ ├── ISub1.cs │ │ │ ├── ISub2.cs │ │ │ ├── IWithRefOut.cs │ │ │ ├── IFooWithIntPtr.cs │ │ │ ├── IFooWithOutIntPtr.cs │ │ │ ├── IFooWithOutUIntPtr.cs │ │ │ ├── IFooWithUIntPtr.cs │ │ │ ├── IGenericWithProperty.cs │ │ │ ├── IDecimalOutParam.cs │ │ │ ├── IGenericWithEvent.cs │ │ │ ├── INullable.cs │ │ │ ├── IInterfaceWithAsynchronousMethod.cs │ │ │ ├── IdenticalInterfaces.cs │ │ │ ├── IEmpty.cs │ │ │ ├── IHaveIndexers.cs │ │ │ ├── IGenericWithNonGenericMethod.cs │ │ │ ├── IGenericInterfaceWithGenericMethodWithCascadingConstraintOnClass.cs │ │ │ ├── IGenericInterfaceWithGenericMethodWithCascadingConstraintOnInterface.cs │ │ │ ├── ISimple.cs │ │ │ ├── IGenericInterfaceWithGenericMethodWithCascadingConstraintOnAnyReferenceType.cs │ │ │ ├── IGenericInterfaceWithGenericMethodWithCascadingConstraintOnAnyTypeWithDefaultConstructor.cs │ │ │ └── ISharedName.cs │ │ ├── InterClasses │ │ │ ├── IExtendedService.cs │ │ │ ├── InterfaceWithIndexer.cs │ │ │ ├── One.cs │ │ │ ├── ClassWithIndexer.cs │ │ │ ├── OneAndEmpty.cs │ │ │ ├── IService2.cs │ │ │ ├── ClassWithMarkerInterface.cs │ │ │ ├── IClassWithMultiDimentionalArray.cs │ │ │ ├── OneTwo.cs │ │ │ ├── Two.cs │ │ │ ├── WithRefOutEmpty.cs │ │ │ └── WithRefOut.cs │ │ ├── ProxyKind.cs │ │ ├── Serialization │ │ │ ├── IMixedInterface.cs │ │ │ ├── ComplexHolder.cs │ │ │ ├── EventHandlerClass.cs │ │ │ ├── C.cs │ │ │ ├── SerializableMixin.cs │ │ │ ├── IndirectDelegateHolder.cs │ │ │ ├── SerializableExplicitImpl.cs │ │ │ ├── BadSerializable.cs │ │ │ ├── DelegateHolder.cs │ │ │ └── ClassWithIndirectSelfReference.cs │ │ ├── Mixins │ │ │ ├── IDerivedSimpleMixin.cs │ │ │ ├── OtherMixin.cs │ │ │ ├── OtherMixinImplementingISimpleMixin.cs │ │ │ ├── ClassImplementingISimpleMixin.cs │ │ │ ├── ClassImplementingIDerivedSImpleMixin.cs │ │ │ └── SimpleMixin.cs │ │ ├── GenInterfaces │ │ │ ├── GenericMethodWhereOneGenParamInheritsTheOther.cs │ │ │ ├── IHaveGenericMethodWithEnumConstraint.cs │ │ │ ├── GenInterfaceWithMethodWithNestedGenericReturn.cs │ │ │ ├── IConstraint_Method1IsTypeStructAndMethod2.cs │ │ │ ├── GenInterfaceWithMethodWithNestedGenericParameter.cs │ │ │ ├── IHaveGenericMethodWithNewClassStructConstraints.cs │ │ │ ├── GenInterface.cs │ │ │ ├── GenInterfaceWithMethodWithNestedGenericParameterByRef.cs │ │ │ ├── GenInterfaceWithGenMethods.cs │ │ │ ├── OnlyGenMethodsInterface.cs │ │ │ └── GenInterfaceWithGenMethodsAndGenReturn.cs │ │ ├── Interceptors │ │ │ ├── DoNothingInterceptor.cs │ │ │ ├── ThrowingInterceptor.cs │ │ │ ├── ThrowingInterceptorException.cs │ │ │ └── AssertCannotChangeTargetInterceptor.cs │ │ ├── Explicit │ │ │ ├── GenInterfaceExplicit.cs │ │ │ ├── TwoInterfacesExplicit.cs │ │ │ ├── GenericMethodExplicit.cs │ │ │ ├── WithRefOutExplicit.cs │ │ │ └── SimpleInterfaceExplicit.cs │ │ ├── GenClasses │ │ │ ├── ClassWithMethodWithArrayOfListOfT.cs │ │ │ ├── MethodWithArgumentBeingArrayOfGenericTypeOfT.cs │ │ │ ├── ClassWithMethodWithGenericOfGenericOfT.cs │ │ │ ├── GenClassWithGenReturn.cs │ │ │ ├── OnlyGenMethodsClass.cs │ │ │ ├── GenClassWithConstraints.cs │ │ │ └── ClassWithIndexer.cs │ │ ├── ComInteropTypes │ │ │ └── ADODB │ │ │ │ ├── Connection.cs │ │ │ │ └── README.md │ │ └── BugsReported │ │ │ └── DynProxy132.cs │ ├── Components.DictionaryAdapter.Tests │ │ ├── Color.cs │ │ ├── IPersonWithMethod.cs │ │ ├── IPersonWithoutPrefix.cs │ │ ├── IUseBehaviorBuilder.cs │ │ ├── IPhoneWithFetch.cs │ │ ├── IPersonWithPrefix.cs │ │ ├── IItemContainerWithComponent.cs │ │ ├── IPersonWithTypePrefixOverride.cs │ │ ├── IPersonWithPrefixOverride.cs │ │ ├── IEnsureMetaDoesNotConflict.cs │ │ ├── IStringLists.cs │ │ ├── IPhone.cs │ │ ├── IConversionsToString.cs │ │ ├── IPersonWithPrefixOverrideFurtherOverride.cs │ │ ├── IMutableName.cs │ │ ├── IName.cs │ │ └── IPersonWithDeniedInheritancePrefix.cs │ ├── InternalsVisibleTo.cs │ └── BugAttribute.cs ├── Castle.Core │ ├── DynamicProxy │ │ ├── DynProxy.snk │ │ ├── Generators │ │ │ ├── Emitters │ │ │ │ ├── SimpleAST │ │ │ │ │ ├── IExpression.cs │ │ │ │ │ ├── IStatement.cs │ │ │ │ │ ├── IExpressionOrStatement.cs │ │ │ │ │ ├── TryStatement.cs │ │ │ │ │ ├── FinallyStatement.cs │ │ │ │ │ ├── EndExceptionBlockStatement.cs │ │ │ │ │ └── NullExpression.cs │ │ │ │ └── IMemberEmitter.cs │ │ │ └── IGenerator.cs │ │ ├── IInterceptor.cs │ │ ├── Contributors │ │ │ └── IMembersCollectorSink.cs │ │ └── Tokens │ │ │ ├── DelegateMethods.cs │ │ │ ├── InterceptorSelectorMethods.cs │ │ │ ├── MethodBaseMethods.cs │ │ │ └── TypeMethods.cs │ ├── Core │ │ ├── Logging │ │ │ ├── IContextStacks.cs │ │ │ └── IContextStack.cs │ │ └── IServiceProviderEx.cs │ ├── Components.DictionaryAdapter │ │ ├── Util │ │ │ ├── IVirtualSite.cs │ │ │ ├── IVirtualTarget.cs │ │ │ ├── IValueInitializer.cs │ │ │ ├── IBindingListSource.cs │ │ │ ├── ICondition.cs │ │ │ ├── ICollectionProjection.cs │ │ │ └── IVirtual.cs │ │ ├── Xml │ │ │ └── Internal │ │ │ │ ├── Cursors │ │ │ │ └── Base │ │ │ │ │ ├── IXmlNodeSource.cs │ │ │ │ │ ├── IXmlIterator.cs │ │ │ │ │ ├── IXmlNamespaceSource.cs │ │ │ │ │ └── IXmlCursor.cs │ │ │ │ ├── Utilities │ │ │ │ ├── IConfigurable.cs │ │ │ │ └── StringExtensions.cs │ │ │ │ ├── Serializers │ │ │ │ └── XmlTypeKind.cs │ │ │ │ ├── Types │ │ │ │ ├── IXmlIdentity.cs │ │ │ │ ├── IXmlKnownType.cs │ │ │ │ └── IXmlIncludedType.cs │ │ │ │ ├── Namespaces │ │ │ │ ├── Xmlns.cs │ │ │ │ ├── Xsd.cs │ │ │ │ └── Wsdl.cs │ │ │ │ └── Accessors │ │ │ │ ├── XmlAccessorFactory.cs │ │ │ │ └── IXmlBehaviorSemantics.cs │ │ ├── IDictionaryCoerceStrategy.cs │ │ ├── IDictionaryCopyStrategy.cs │ │ ├── IDictionaryCreateStrategy.cs │ │ ├── IDictionaryEqualityHashCodeStrategy.cs │ │ ├── Attributes │ │ │ ├── XmlDefaultsAttribute.cs │ │ │ ├── IfExistsAttribute.cs │ │ │ ├── VolatileAttribute.cs │ │ │ └── ReferenceAttribute.cs │ │ ├── IDictionaryBehaviorBuilder.cs │ │ └── IDictionaryReferenceManager.cs │ └── Properties │ │ └── InternalsVisibleToTests.cs └── Castle.Core.Tests.WeakNamed │ ├── Program.cs │ ├── InternalsVisibleTo.cs │ └── App.config ├── docs ├── images │ ├── matrix.jpg │ ├── castle-logo.png │ └── proxy-pipeline.png ├── markdownlint.rb ├── dynamicproxy-serializable-types.md ├── CONTRIBUTING.md ├── dynamicproxy-generation-hook-override-equals-gethashcode.md ├── README.md └── dynamicproxy-generation-hook-pure-function.md ├── CONTRIBUTING.md ├── nuget.config ├── .gitignore ├── tools └── Explicit.NuGet.Versions │ └── Explicit.NuGet.Versions.csproj ├── .editorconfig └── LICENSE /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Core.Tests/Resource/file1.txt: -------------------------------------------------------------------------------- 1 | Something -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Core.Tests/Resource/MoreRes/file2.txt: -------------------------------------------------------------------------------- 1 | Another thing -------------------------------------------------------------------------------- /docs/images/matrix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/CastleCore/master/docs/images/matrix.jpg -------------------------------------------------------------------------------- /docs/images/castle-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/CastleCore/master/docs/images/castle-logo.png -------------------------------------------------------------------------------- /docs/images/proxy-pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/CastleCore/master/docs/images/proxy-pipeline.png -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/DynProxy.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/CastleCore/master/src/Castle.Core/DynamicProxy/DynProxy.snk -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | Information on contributing to this project can be found in the [Castle Project Contributing Guide](https://github.com/castleproject/Home/blob/master/CONTRIBUTING.md) located in our Home repository. 3 | -------------------------------------------------------------------------------- /nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/markdownlint.rb: -------------------------------------------------------------------------------- 1 | all 2 | exclude_rule 'MD010' # Hard tabs - too much example code has tabs 3 | exclude_rule 'MD013' # Line length 4 | exclude_rule 'MD033' # Inline HTML - for right-aligning an image 5 | exclude_rule 'MD040' # Fenced code blocks should have a language specified -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using NUnit.Common; 4 | using NUnitLite; 5 | 6 | internal class Program 7 | { 8 | public static int Main(string[] args) 9 | { 10 | return new AutoRun(typeof(Program).Assembly) 11 | .Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests.WeakNamed/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using NUnit.Common; 4 | using NUnitLite; 5 | 6 | internal class Program 7 | { 8 | public static int Main(string[] args) 9 | { 10 | return new AutoRun(typeof(Program).Assembly) 11 | .Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); 12 | } 13 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # User-specific files 2 | *.suo 3 | *.user 4 | .vs 5 | _ReSharper*/ 6 | *.csproj.ReSharper 7 | 8 | # Build output 9 | build/ 10 | bin/ 11 | obj/ 12 | 13 | # Unit test scratch file (for DictionaryAdapter tests) and test runner results 14 | /out.xml 15 | /NetCoreClrTestResults.xml 16 | /DesktopClrTestResults.xml 17 | /DesktopClrWeakNamedTestResults.xml 18 | /NetCoreClrWeakNamedTestResults.xml 19 | -------------------------------------------------------------------------------- /docs/dynamicproxy-serializable-types.md: -------------------------------------------------------------------------------- 1 | # Make your supporting classes serializable 2 | 3 | If you're going to be serializing your proxies, you should make all the classes that go with it serializable. That includes proxy generation hooks, interceptors and interceptor selectors. Otherwise, you will get an exception when trying to serialize your proxies. It is not mandatory, but I find it useful. Notice that you will need this also when persisting your proxy assembly to disk. -------------------------------------------------------------------------------- /tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net462 6 | build\ 7 | false 8 | nev 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | 6 | [*.csproj] 7 | indent_style = tab 8 | indent_size = 2 9 | 10 | [*.cs] 11 | indent_style = tab 12 | indent_size = 4 13 | csharp_prefer_braces = true:suggestion 14 | dotnet_separate_import_directive_groups = true 15 | dotnet_sort_system_directives_first = true 16 | dotnet_style_qualification_for_event = false 17 | dotnet_style_qualification_for_field = false 18 | dotnet_style_qualification_for_method = false 19 | dotnet_style_qualification_for_property = false 20 | -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | The documentation is written in Markdown. 2 | 3 | [Atom](https://atom.io/) is a good editor for GitHub Flavored Markdown because it has a preview window. 4 | 5 | To keep the syntax consistent we use [markdownlint](https://github.com/mivok/markdownlint), please run it if you are changing 6 | a significant amount of documentation. 7 | 8 | Markdownlint can be installed by running. 9 | 10 | ``` 11 | gem install mdl 12 | ``` 13 | 14 | Running the linter is as easy as: 15 | 16 | ``` 17 | cd doc 18 | mdl --style=markdownlint.rb . 19 | ``` -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2004-2021 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. -------------------------------------------------------------------------------- /docs/dynamicproxy-generation-hook-override-equals-gethashcode.md: -------------------------------------------------------------------------------- 1 | # Overriding Equals/GetHashCode on proxy generation hook 2 | 3 | ## Equals/GetHashCode 4 | 5 | One of the most common mistakes when it comes to DynamicProxy is not overriding `Equals`/`GetHashCode` methods on proxy generation hooks, which means you're giving up caching and that in turn coupled with bugs in BCL means performance hit (plus increased memory consumption). 6 | 7 | ## Solution 8 | 9 | Solution is very simple, and there's no exceptions to this rule – always override `Equals`/`GetHashCode` methods on all your classes implementing `IProxyGenerationHook`. 10 | 11 | ## See also 12 | 13 | * [Make proxy generation hooks purely functional](dynamicproxy-generation-hook-pure-function.md) -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Castle Core Documentation 2 | 3 | 4 | 5 | ## Logging 6 | 7 | [Logging Services](logging.md) - logging abstractions and implementations for common scenarios and logging frameworks. 8 | 9 | ## DynamicProxy 10 | 11 | [Castle DynamicProxy](dynamicproxy.md) - a lightweight, lightning fast framework for generating proxies on the fly, used extensively by multiple projects within Castle (Windsor) and outside of it (Moq, NSubstitute, FakeItEasy, Rhino Mocks). 12 | 13 | ## DictionaryAdapter 14 | 15 | [Castle DictionaryAdapter](dictionaryadapter.md) - on the fly generates strongly typed wrappers around untyped dictionaries, or chunks of XML (like config file), optionally adding support for change notification, cancelation, error notification and other features. 16 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/EmptyClass.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class EmptyClass 18 | { 19 | } 20 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/SimpleClass.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class SimpleClass 18 | { 19 | } 20 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Records/EmptyRecord.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2022 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Records 16 | { 17 | public record EmptyRecord 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/Color.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | public enum Color { Red, Green, Blue }; 18 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IBase 18 | { 19 | void Foo(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IOne.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IOne 18 | { 19 | int OneMethod(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/ITwo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface ITwo 18 | { 19 | int TwoMethod(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Records/EmptyGenericRecord.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2022 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Records 16 | { 17 | public record EmptyGenericRecord 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Castle.Core/Core/Logging/IContextStacks.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Core.Logging 16 | { 17 | public interface IContextStacks 18 | { 19 | IContextStack this[string key] { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/ISub1.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface ISub1 : IBase 18 | { 19 | void Bar(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/ISub2.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface ISub2 : IBase 18 | { 19 | void Baz(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/HasFinalizer.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class HasFinalizer 18 | { 19 | ~HasFinalizer() 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Records/DerivedFromEmptyRecord.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2022 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Records 16 | { 17 | public record DerivedFromEmptyRecord : EmptyRecord 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/InternalsVisibleTo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | using System.Runtime.CompilerServices; 16 | using Castle.Core.Internal; 17 | 18 | [assembly: InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)] 19 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests.WeakNamed/InternalsVisibleTo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | using System.Runtime.CompilerServices; 16 | using Castle.Core.Internal; 17 | 18 | [assembly: InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)] 19 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Util/IVirtualSite.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | public interface IVirtualSite 18 | { 19 | void OnRealizing(T node); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/Component2.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class Component2 18 | { 19 | public virtual void DoOperation2() 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/IExpression.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST 16 | { 17 | internal interface IExpression : IExpressionOrStatement 18 | { 19 | } 20 | } -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/IStatement.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST 16 | { 17 | internal interface IStatement : IExpressionOrStatement 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IPersonWithMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | public interface IPersonWithMethod : IPerson 18 | { 19 | void Run(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/IExtendedService.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | public interface IExtendedService : IService 18 | { 19 | void DoSomething(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/ProxyKind.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests 16 | { 17 | public enum ProxyKind 18 | { 19 | Class, 20 | WithTarget, 21 | WithoutTarget, 22 | WithTargetInterface 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/IMixedInterface.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Serialization 16 | { 17 | public interface IMixedInterface 18 | { 19 | object GetExecutingObject(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Mixins/IDerivedSimpleMixin.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Mixins 16 | { 17 | public interface IDerivedSimpleMixin : ISimpleMixin 18 | { 19 | int DoSomethingDerived(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/AbstractClassWithMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public abstract class AbstractClassWithMethod 18 | { 19 | public abstract int Method(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IWithRefOut.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IWithRefOut 18 | { 19 | void Do(out int i); 20 | void Did(ref int i); 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Records/DerivedFromEmptyGenericRecord.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2022 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Records 16 | { 17 | public record DerivedFromEmptyGenericRecord : EmptyGenericRecord 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/InterfaceWithIndexer.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | public interface InterfaceWithIndexer 18 | { 19 | object this[int index] { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IFooWithIntPtr.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | using System; 18 | 19 | public interface IFooWithIntPtr 20 | { 21 | IntPtr Buffer(UInt32 index); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IFooWithOutIntPtr.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | using System; 18 | 19 | public interface IFooWithOutIntPtr 20 | { 21 | int Bar(out IntPtr i); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IFooWithOutUIntPtr.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | using System; 18 | 19 | public interface IFooWithOutUIntPtr 20 | { 21 | int Bar(out UIntPtr i); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IFooWithUIntPtr.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | using System; 18 | 19 | public interface IFooWithUIntPtr 20 | { 21 | UIntPtr Buffer(UInt32 index); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IGenericWithProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IGenericWithProperty 18 | { 19 | object SomeProperty { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Cursors/Base/IXmlNodeSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | public interface IXmlNodeSource 18 | { 19 | IXmlNode Node { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Utilities/IConfigurable.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | public interface IConfigurable 18 | { 19 | void Configure(T value); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Serializers/XmlTypeKind.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | public enum XmlTypeKind 18 | { 19 | Simple, 20 | Complex, 21 | Collection 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IPersonWithoutPrefix.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | public interface IPersonWithoutPrefix : IPerson 18 | { 19 | int NumberOfFeet { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/VirtualClassWithAutoProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class VirtualClassWithAutoProperty 18 | { 19 | public virtual int AutoProperty { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/HasVirtualStringAutoProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2019 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class HasVirtualStringAutoProperty 18 | { 19 | public virtual string Property { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IDecimalOutParam.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IDecimalOutParam 18 | { 19 | void Dance(out decimal fuel); 20 | void Run(out T fuel); 21 | } 22 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IGenericWithEvent.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | using System; 18 | 19 | public interface IGenericWithEvent 20 | { 21 | event EventHandler SomeEvent; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Util/IVirtualTarget.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | public interface IVirtualTarget 18 | { 19 | void OnRealizing(TNode node, TMember member); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/ClassWithCharRetType.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class ClassWithCharRetType 18 | { 19 | public virtual char DoSomething() 20 | { 21 | return 'c'; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/ClassWithIndexer.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using Castle.DynamicProxy.Tests.GenClasses; 18 | 19 | public class ClassWithIndexer : ClassWithIndexer 20 | { } 21 | } 22 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/VirtualClassWithMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class VirtualClassWithMethod 18 | { 19 | public virtual int Method() 20 | { 21 | return 42; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/INullable.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface INullable 18 | { 19 | int? Get(); 20 | void GetOut(out int? param); 21 | void Set(int? param); 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Types/IXmlIdentity.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | public interface IXmlIdentity 18 | { 19 | XmlName Name { get; } 20 | XmlName XsiType { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Util/IValueInitializer.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | public interface IValueInitializer 18 | { 19 | void Initialize(IDictionaryAdapter dictionaryAdapter, object value); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Cursors/Base/IXmlIterator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | using System; 18 | 19 | public interface IXmlIterator : IXmlNode 20 | { 21 | bool MoveNext(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IUseBehaviorBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | public interface IUseBehaviorBuilder 18 | { 19 | [KeyBehaviorBuilder] 20 | string First_Name { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Types/IXmlKnownType.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | using System; 18 | 19 | public interface IXmlKnownType : IXmlIdentity 20 | { 21 | Type ClrType { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/HasCtorWithParamsArgument.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class HasCtorWithParamsArgument 18 | { 19 | public HasCtorWithParamsArgument(params object[] arguments) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/HasCtorWithParamsStrings.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class HasCtorWithParamsStrings 18 | { 19 | public HasCtorWithParamsStrings(params string[] arguments) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Util/IBindingListSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System.ComponentModel; 18 | 19 | public interface IBindingListSource 20 | { 21 | IBindingList AsBindingList { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IPhoneWithFetch.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | [Fetch] 18 | public interface IPhoneWithFetch 19 | { 20 | string Extension { get; set; } 21 | string Number { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/ClassWithVirtualInterface.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class ClassWithVirtualInterface : ISimpleInterface 18 | { 19 | public virtual int Do() 20 | { 21 | return 5; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/IHasNonInheritableAttributeWithArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | [NonInheritableWithArray(Values = new[] {"1", "2", "3"})] 18 | public interface IHasNonInheritableAttributeWithArray 19 | { 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IPersonWithPrefix.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | [KeyPrefix("Person_")] 18 | public interface IPersonWithPrefix : IPersonWithoutPrefix 19 | { 20 | Color HairColor { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/IHasNonInheritableAttributeWithArray2.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | [NonInheritableWithArray2(Values = new[] {"1", "2", "3"})] 18 | public interface IHasNonInheritableAttributeWithArray2 19 | { 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/One.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | using Castle.DynamicProxy.Tests.Interfaces; 18 | 19 | public class One : IOne 20 | { 21 | public int OneMethod() 22 | { 23 | return 1; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IInterfaceWithAsynchronousMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | using System.Threading.Tasks; 18 | 19 | public interface IInterfaceWithAsynchronousMethod 20 | { 21 | Task Method(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/IDictionaryCoerceStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System; 18 | 19 | public interface IDictionaryCoerceStrategy 20 | { 21 | object Coerce(IDictionaryAdapter adapter, Type type); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Generators/IGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Generators 16 | { 17 | using Castle.DynamicProxy.Generators.Emitters; 18 | 19 | internal interface IGenerator 20 | { 21 | T Generate(ClassEmitter @class, INamingScope namingScope); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IdenticalInterfaces.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IIdenticalTwo 18 | { 19 | string Foo(); 20 | } 21 | 22 | public interface IIdenticalOne 23 | { 24 | string Foo(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Castle.Core/Core/Logging/IContextStack.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Core.Logging 16 | { 17 | using System; 18 | 19 | public interface IContextStack 20 | { 21 | int Count { get; } 22 | 23 | void Clear(); 24 | 25 | string Pop(); 26 | 27 | IDisposable Push(string message); 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IItemContainerWithComponent.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | public interface IItemContainerWithComponent : IDictionaryNotify 18 | { 19 | [Component] 20 | TItem Item { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/VirtualClassWithPublicField.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class VirtualClassWithPublicField 18 | { 19 | public int field; 20 | public virtual int Method() 21 | { 22 | return 42; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/GenericMethodWhereOneGenParamInheritsTheOther.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | public interface GenericMethodWhereOneGenParamInheritsTheOther 18 | { 19 | T2 Foo(T1 foo) where T1 : T2; 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Util/ICondition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | /// 18 | /// Contract for value matching. 19 | /// 20 | public interface ICondition 21 | { 22 | bool SatisfiedBy(object value); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Types/IXmlIncludedType.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | using System; 18 | 19 | public interface IXmlIncludedType 20 | { 21 | XmlName XsiType { get; } 22 | Type ClrType { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/IExpressionOrStatement.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST 16 | { 17 | using System.Reflection.Emit; 18 | 19 | internal interface IExpressionOrStatement 20 | { 21 | void Emit(ILGenerator gen); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IPersonWithTypePrefixOverride.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | [TypeKeyPrefix] 18 | public interface IPersonWithTypePrefixOverride : IPersonWithPrefixOverride 19 | { 20 | int Height { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/VirtuallyImplementsInterfaceWithProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class VirtuallyImplementsInterfaceWithProperty:IHasProperty 18 | { 19 | public virtual int Prop 20 | { 21 | get; set; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/HasCtorWithIntAndParamsArgument.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class HasCtorWithIntAndParamsArgument 18 | { 19 | public HasCtorWithIntAndParamsArgument(int first, params object[] arguments) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/InheritsAbstractClassWithMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class InheritsAbstractClassWithMethod : AbstractClassWithMethod 18 | { 19 | public override int Method() 20 | { 21 | return 42; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Namespaces/Xmlns.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | public static class Xmlns 18 | { 19 | public const string 20 | Prefix = "xmlns", 21 | NamespaceUri = "http://www.w3.org/2000/xmlns/"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/ClassWithIndexer.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | public class ClassWithIndexer : InterfaceWithIndexer 18 | { 19 | public object this[int index] 20 | { 21 | get { return index; } 22 | set { } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/OneAndEmpty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | using Castle.DynamicProxy.Tests.Interfaces; 18 | 19 | public class OneAndEmpty : IOne, IEmpty 20 | { 21 | public int OneMethod() 22 | { 23 | return 1; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interceptors/DoNothingInterceptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interceptors 16 | { 17 | public class DoNothingInterceptor : IInterceptor 18 | { 19 | public void Intercept(IInvocation invocation) 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IEmpty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | using System; 18 | 19 | public interface IEmpty 20 | { 21 | } 22 | 23 | #if FEATURE_SERIALIZATION 24 | [Serializable] 25 | #endif 26 | public class Empty : IEmpty 27 | { 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/IInterceptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy 16 | { 17 | /// 18 | /// Provides the main DynamicProxy extension point that allows member interception. 19 | /// 20 | public interface IInterceptor 21 | { 22 | void Intercept(IInvocation invocation); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IHaveIndexers.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | using System; 18 | 19 | public interface IHaveIndexers 20 | { 21 | string this[string name] { get; } 22 | string this[Guid id] { get; } 23 | string this[Type type] { get; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Mixins/OtherMixin.cs: -------------------------------------------------------------------------------- 1 | // You may obtain a copy of the License at 2 | // 3 | // http://www.apache.org/licenses/LICENSE-2.0 4 | // 5 | // Unless required by applicable law or agreed to in writing, software 6 | // distributed under the License is distributed on an "AS IS" BASIS, 7 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8 | // See the License for the specific language governing permissions and 9 | // limitations under the License. 10 | 11 | namespace Castle.DynamicProxy.Tests.Mixins 12 | { 13 | using System; 14 | 15 | public interface IOtherMixin 16 | { 17 | int Sum(int x, int y); 18 | } 19 | 20 | #if FEATURE_SERIALIZATION 21 | [Serializable] 22 | #endif 23 | public class OtherMixin : IOtherMixin 24 | { 25 | public OtherMixin() 26 | { 27 | } 28 | 29 | #region IOtherMixin Members 30 | 31 | public int Sum(int x, int y) 32 | { 33 | return x + y; 34 | } 35 | 36 | #endregion 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IPersonWithPrefixOverride.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | [KeyPrefix("Person2_")] 18 | public interface IPersonWithPrefixOverride : IPersonWithPrefix 19 | { 20 | [Key("Eye__Color")] 21 | Color EyeColor { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/IHaveGenericMethodWithEnumConstraint.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2023 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | using System; 18 | 19 | public interface IHaveGenericMethodWithEnumConstraint 20 | { 21 | void Method(out TEnum result) where TEnum : Enum; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/NonPublicMethodsClass.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class NonPublicMethodsClass 18 | { 19 | public virtual void DoSomething() 20 | { 21 | DoOtherThing(); 22 | } 23 | 24 | protected virtual void DoOtherThing() 25 | { 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/ComplexHolder.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | #if FEATURE_SERIALIZATION 16 | 17 | namespace Castle.DynamicProxy.Tests.Serialization 18 | { 19 | using System; 20 | 21 | [Serializable] 22 | public class ComplexHolder 23 | { 24 | public object Element; 25 | public Type Type; 26 | } 27 | } 28 | 29 | #endif -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Accessors/XmlAccessorFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | using System; 18 | 19 | public delegate TAccessor 20 | XmlAccessorFactory(string name, Type type, IXmlContext context) 21 | where TAccessor : XmlAccessor; 22 | } 23 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/IDictionaryCopyStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System; 18 | 19 | public interface IDictionaryCopyStrategy 20 | { 21 | bool Copy(IDictionaryAdapter source, IDictionaryAdapter target, ref Func selector); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IEnsureMetaDoesNotConflict.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | public interface IEnsureMetaDoesNotConflict 18 | { 19 | string Dictionary { get; set; } 20 | 21 | object Properties { get; set; } 22 | 23 | int FetchProperties { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/ClassWithInterface.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | #if FEATURE_SERIALIZATION 20 | [Serializable] 21 | #endif 22 | public class ClassWithInterface : ISimpleInterface 23 | { 24 | public int Do() 25 | { 26 | return 5; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/InheritableAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | #if FEATURE_SERIALIZATION 20 | [Serializable] 21 | #endif 22 | [AttributeUsage(AttributeTargets.All, Inherited = true)] 23 | public class InheritableAttribute : Attribute 24 | { 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Mixins/OtherMixinImplementingISimpleMixin.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Mixins 16 | { 17 | using System; 18 | 19 | public class OtherMixinImplementingISimpleMixin : ISimpleMixin 20 | { 21 | public int DoSomething() 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/IDictionaryCreateStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System; 18 | using System.Collections; 19 | 20 | public interface IDictionaryCreateStrategy 21 | { 22 | object Create(IDictionaryAdapter adapter, Type type, IDictionary dictionary); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Util/ICollectionProjection.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System.Collections; 18 | 19 | public interface ICollectionProjection : ICollection 20 | { 21 | void Replace(IEnumerable source); 22 | void Clear(); 23 | void ClearReferences(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Contributors/IMembersCollectorSink.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Contributors 16 | { 17 | using Castle.DynamicProxy.Generators; 18 | 19 | internal interface IMembersCollectorSink 20 | { 21 | void Add(MetaEvent @event); 22 | void Add(MetaMethod method); 23 | void Add(MetaProperty property); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/TryStatement.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST 16 | { 17 | using System.Reflection.Emit; 18 | 19 | internal class TryStatement : IStatement 20 | { 21 | public void Emit(ILGenerator gen) 22 | { 23 | gen.BeginExceptionBlock(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /docs/dynamicproxy-generation-hook-pure-function.md: -------------------------------------------------------------------------------- 1 | # Make proxy generation hooks purely functional 2 | 3 | Pure function, is a function that for given set of inputs always returns the same output. In case of proxy generation hook, it means that two equal (as specified by overridden `Equals`/`GetHashCode` methods) proxy generation hooks will for given type to proxy return the same values from their methods, and when asked again about the same type will again return the same values/throw the same exceptions. 4 | 5 | This is a major assumption that DynamicProxy makes, and that's what makes the caching mechanism work. If proxy generation hook is equal to the one already used to generate a proxy type, DynamicProxy will assume it would return the same values as the other one, which would result in identical proxy type, so it cuts through the generation process and returns the existing proxy type. 6 | 7 | ## See also 8 | 9 | * [Overriding Equals/GetHashCode on proxy generation hook](dynamicproxy-generation-hook-override-equals-gethashcode.md) -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IStringLists.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | using System.Collections.Generic; 18 | 19 | public interface IStringLists 20 | { 21 | [StringList] 22 | IList Names { get; } 23 | 24 | [StringList] 25 | IList Ages { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/HasTwoProtectedMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class HasTwoProtectedMethods 18 | { 19 | protected virtual int Method1() 20 | { 21 | return 42; 22 | } 23 | 24 | protected virtual string Method2() 25 | { 26 | return "42"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Explicit/GenInterfaceExplicit.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Explicit 16 | { 17 | using Castle.DynamicProxy.Tests.GenInterfaces; 18 | 19 | public class GenInterfaceExplicit : GenInterface 20 | { 21 | int GenInterface.DoSomething(int t) 22 | { 23 | return t + 1; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/IService2.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | using System; 18 | 19 | public interface IService2 20 | { 21 | void DoOperation2(); 22 | } 23 | 24 | public class Service2 : IService2 25 | { 26 | public void DoOperation2() 27 | { 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interceptors/ThrowingInterceptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interceptors 16 | { 17 | public class ThrowingInterceptor : IInterceptor 18 | { 19 | public void Intercept(IInvocation invocation) 20 | { 21 | throw new ThrowingInterceptorException("Because I feel like it"); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interceptors/ThrowingInterceptorException.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interceptors 16 | { 17 | using System; 18 | 19 | public class ThrowingInterceptorException : Exception 20 | { 21 | public ThrowingInterceptorException(string message) 22 | : base(message) 23 | { 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IGenericWithNonGenericMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IGenericWithNonGenericMethod 18 | { 19 | void SomeMethod(); 20 | } 21 | 22 | public interface IGenericWithNonGenericMethod 23 | { 24 | void SomeMethod(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/FinallyStatement.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST 16 | { 17 | using System.Reflection.Emit; 18 | 19 | internal class FinallyStatement : IStatement 20 | { 21 | public void Emit(ILGenerator gen) 22 | { 23 | gen.BeginFinallyBlock(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IPhone.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | using System.ComponentModel; 18 | 19 | public interface IPhone : IEditableObject, INotifyPropertyChanged, IDataErrorInfo 20 | { 21 | [Fetch]string Number { get; set; } 22 | string Extension { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/NonInheritableAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | #if FEATURE_SERIALIZATION 20 | [Serializable] 21 | #endif 22 | [AttributeUsage(AttributeTargets.All, Inherited = false)] 23 | public class NonInheritableAttribute : Attribute 24 | { 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenClasses/ClassWithMethodWithArrayOfListOfT.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenClasses 16 | { 17 | using System.Collections.Generic; 18 | 19 | public abstract class ClassWithMethodWithArrayOfListOfT 20 | { 21 | public virtual void GenericMethodWithListArrayArgument(List[] action) { } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/ClassWithMarkerInterface.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | public interface IMarkerInterface 20 | { 21 | } 22 | 23 | #if FEATURE_SERIALIZATION 24 | [Serializable] 25 | #endif 26 | public class ClassWithMarkerInterface 27 | { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Castle.Core/Core/IServiceProviderEx.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Core 16 | { 17 | using System; 18 | 19 | /// 20 | /// Increments IServiceProvider with a generic service resolution operation. 21 | /// 22 | public interface IServiceProviderEx : IServiceProvider 23 | { 24 | T GetService() where T : class; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IConversionsToString.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | using System.ComponentModel; 18 | 19 | [StringValues] 20 | public interface IConversionsToString : IConversions 21 | { 22 | [TypeConverter(typeof(PhoneConverter))] 23 | Phone Phone { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/GenInterfaceWithMethodWithNestedGenericReturn.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | using System; 18 | using System.Collections.Generic; 19 | 20 | public interface GenInterfaceWithMethodWithNestedGenericReturn 21 | { 22 | IEnumerable> Foo(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/IClassWithMultiDimentionalArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | public interface IClassWithMultiDimentionalArray 18 | { 19 | void Do(int[] args); 20 | 21 | void Do2(int[,] args); 22 | 23 | void Do3(string[] args); 24 | 25 | void Do4(string[,] args); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Cursors/Base/IXmlNamespaceSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | public interface IXmlNamespaceSource 18 | { 19 | string GetElementPrefix (IXmlNode node, string namespaceUri); 20 | string GetAttributePrefix(IXmlNode node, string namespaceUri); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Utilities/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | using System; 18 | 19 | internal static class StringExtensions 20 | { 21 | public static string NonEmpty(this string s) 22 | { 23 | return string.IsNullOrEmpty(s) ? null : s; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/EventHandlerClass.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | #if FEATURE_SERIALIZATION 16 | 17 | namespace Castle.DynamicProxy.Tests.Serialization 18 | { 19 | using System; 20 | 21 | [Serializable] 22 | public class EventHandlerClass 23 | { 24 | public void TestHandler(object sender, EventArgs e) 25 | { 26 | } 27 | } 28 | } 29 | 30 | #endif -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Explicit/TwoInterfacesExplicit.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Explicit 16 | { 17 | using System; 18 | 19 | public class TwoInterfacesExplicit : ISimpleInterface, IDisposable 20 | { 21 | void IDisposable.Dispose() 22 | { 23 | } 24 | 25 | int ISimpleInterface.Do() 26 | { 27 | return 5; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/IConstraint_Method1IsTypeStructAndMethod2.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | public interface IConstraint_Method1IsTypeStructAndMethod2 18 | { 19 | void Method(TMethod1 one, TMethod2 two, TType three) where TMethod1 : struct, TType, TMethod2; 20 | } 21 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/OneTwo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | using Castle.DynamicProxy.Tests.Interfaces; 18 | 19 | public class OneTwo : IOne, ITwo 20 | { 21 | public int OneMethod() 22 | { 23 | return 3; 24 | } 25 | 26 | public int TwoMethod() 27 | { 28 | return 2; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/EndExceptionBlockStatement.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST 16 | { 17 | using System.Reflection.Emit; 18 | 19 | internal class EndExceptionBlockStatement : IStatement 20 | { 21 | public void Emit(ILGenerator gen) 22 | { 23 | gen.EndExceptionBlock(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/BugAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle 16 | { 17 | using System; 18 | 19 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] 20 | public class BugAttribute : Attribute 21 | { 22 | public BugAttribute(string bugId) 23 | { 24 | BugId = bugId; 25 | } 26 | 27 | public string BugId { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IPersonWithPrefixOverrideFurtherOverride.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | using System.ComponentModel; 18 | 19 | public interface IPersonWithPrefixOverrideFurtherOverride : IPersonWithPrefixOverride 20 | { 21 | [DefaultValue(1)] 22 | int NumberOfHeads { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/ClassWithAttributesOnConstructorParameters.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class ClassWithAttributesOnConstructorParameters 18 | { 19 | public ClassWithAttributesOnConstructorParameters([Required(1)] int intParam, [Required("test")] string stringParam) 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/GenInterfaceWithMethodWithNestedGenericParameter.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | using System; 18 | using System.Collections.Generic; 19 | 20 | public interface GenInterfaceWithMethodWithNestedGenericParameter 21 | { 22 | void Foo(IEnumerable> bars); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/IDictionaryEqualityHashCodeStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | public interface IDictionaryEqualityHashCodeStrategy 18 | { 19 | bool Equals(IDictionaryAdapter adapter1, IDictionaryAdapter adapter2); 20 | 21 | bool GetHashCode(IDictionaryAdapter adapter, out int hashCode); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/IHaveGenericMethodWithNewClassStructConstraints.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | public interface IHaveGenericMethodWithNewClassStructConstraints 18 | { 19 | void MethodVoid(T arg1, U arg2, V arg3) 20 | where T : new() 21 | where U : class 22 | where V : struct; 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/Two.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | using System; 18 | 19 | using Castle.DynamicProxy.Tests.Interfaces; 20 | 21 | #if FEATURE_SERIALIZATION 22 | [Serializable] 23 | #endif 24 | public class Two : ITwo 25 | { 26 | public int TwoMethod() 27 | { 28 | return 20; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Attributes/XmlDefaultsAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System; 18 | 19 | [AttributeUsage(AttributeTargets.Interface)] 20 | public class XmlDefaultsAttribute : Attribute 21 | { 22 | public bool Qualified { get; set; } 23 | 24 | public bool IsNullable { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Accessors/IXmlBehaviorSemantics.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | using System; 18 | 19 | public interface IXmlBehaviorSemantics 20 | { 21 | string GetLocalName (T behavior); 22 | string GetNamespaceUri(T behavior); 23 | Type GetClrType (T behavior); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Explicit/GenericMethodExplicit.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Explicit 16 | { 17 | public class GenericMethodExplicit : IGenericInterface 18 | { 19 | T IGenericInterface.GenericMethod() 20 | { 21 | if(typeof(T) == typeof(int)) 22 | { 23 | return (T)(object)7; 24 | } 25 | return default(T); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenClasses/MethodWithArgumentBeingArrayOfGenericTypeOfT.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenClasses 16 | { 17 | using System; 18 | 19 | public class MethodWithArgumentBeingArrayOfGenericTypeOfT 20 | { 21 | 22 | public virtual T Method( Action[] actions) where T : class 23 | { 24 | return default(T); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/C.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | #if FEATURE_SERIALIZATION 16 | 17 | namespace Castle.DynamicProxy.Tests.Serialization 18 | { 19 | using System; 20 | 21 | [Serializable] 22 | public class C 23 | { 24 | public int I; 25 | public C This; 26 | 27 | public C(int i) 28 | { 29 | I = i; 30 | This = this; 31 | } 32 | } 33 | } 34 | 35 | #endif -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Generators/Emitters/IMemberEmitter.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Generators.Emitters 16 | { 17 | using System; 18 | using System.Reflection; 19 | 20 | internal interface IMemberEmitter 21 | { 22 | MemberInfo Member { get; } 23 | 24 | Type ReturnType { get; } 25 | 26 | void EnsureValidCodeBlock(); 27 | 28 | void Generate(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/GenInterface.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | public interface GenInterface where T : new() 18 | { 19 | T DoSomething(T t); 20 | } 21 | 22 | public class GenInterfaceImpl : GenInterface where T : new() 23 | { 24 | public T DoSomething(T t) 25 | { 26 | return t; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/GenInterfaceWithMethodWithNestedGenericParameterByRef.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | using System; 18 | using System.Collections.Generic; 19 | 20 | public interface GenInterfaceWithMethodWithNestedGenericParameterByRef 21 | { 22 | void Foo(ref IEnumerable> bars); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/SerializableMixin.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | #if FEATURE_SERIALIZATION 16 | 17 | namespace Castle.DynamicProxy.Tests.Serialization 18 | { 19 | using System; 20 | 21 | [Serializable] 22 | public class SerializableMixin : IMixedInterface 23 | { 24 | public object GetExecutingObject() 25 | { 26 | return this; 27 | } 28 | } 29 | } 30 | 31 | #endif -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Attributes/IfExistsAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System; 18 | 19 | /// 20 | /// Suppresses any on-demand behaviors. 21 | /// 22 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] 23 | public class IfExistsAttribute : Attribute 24 | { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Tokens/DelegateMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tokens 16 | { 17 | using System; 18 | using System.Reflection; 19 | 20 | internal static class DelegateMethods 21 | { 22 | public static readonly MethodInfo CreateDelegate = 23 | typeof(Delegate).GetMethod("CreateDelegate", new[] { typeof(Type), typeof(object), typeof(MethodInfo) }); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Tokens/InterceptorSelectorMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tokens 16 | { 17 | using System.Reflection; 18 | 19 | internal static class InterceptorSelectorMethods 20 | { 21 | public static readonly MethodInfo SelectInterceptors = typeof(IInterceptorSelector).GetMethod("SelectInterceptors", BindingFlags.Instance | BindingFlags.Public); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/VirtuallyImplementsInterfaceWithEvent.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | public class VirtuallyImplementsInterfaceWithEvent : IHasEvent 20 | { 21 | public virtual event EventHandler MyEvent; 22 | 23 | public void Raise() 24 | { 25 | MyEvent(null, EventArgs.Empty); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenClasses/ClassWithMethodWithGenericOfGenericOfT.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenClasses 16 | { 17 | using System.Collections.Generic; 18 | 19 | public abstract class ClassWithMethodWithGenericOfGenericOfT 20 | { 21 | public virtual void GenericMethodWithGenericOfGenericArgument(IEnumerable> compararers) { } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenClasses/GenClassWithGenReturn.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenClasses 16 | { 17 | public class GenClassWithGenReturn where T : new() where Z : new() 18 | { 19 | public virtual T DoSomethingT() 20 | { 21 | return new T(); 22 | } 23 | 24 | public virtual Z DoSomethingZ() 25 | { 26 | return new Z(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/ComInteropTypes/ADODB/Connection.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.ComInteropTypes.ADODB 16 | { 17 | using System.Runtime.InteropServices; 18 | 19 | [ComImport] 20 | [Guid("00000550-0000-0010-8000-00aa006d2ea4")] 21 | //[CoClass(typeof(ConnectionClass))] 22 | public interface Connection // : (inherited event interface omitted) 23 | { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Explicit/WithRefOutExplicit.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Explicit 16 | { 17 | using Castle.DynamicProxy.Tests.Interfaces; 18 | 19 | public class WithRefOutExplicit : IWithRefOut 20 | { 21 | void IWithRefOut.Did(ref int i) 22 | { 23 | i = 5; 24 | } 25 | 26 | void IWithRefOut.Do(out int i) 27 | { 28 | i = 5; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/WithRefOutEmpty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | using Castle.DynamicProxy.Tests.Interfaces; 18 | 19 | public class WithRefOutAndEmpty : IWithRefOut, IEmpty 20 | { 21 | public void Did(ref int i) 22 | { 23 | i = 5; 24 | } 25 | 26 | public void Do(out int i) 27 | { 28 | i = 5; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Mixins/ClassImplementingISimpleMixin.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Mixins 16 | { 17 | using System; 18 | 19 | #if FEATURE_SERIALIZATION 20 | [Serializable] 21 | #endif 22 | public class ClassImplementingISimpleMixin : ISimpleMixin 23 | { 24 | public int DoSomething() 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IMutableName.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | public interface IMutableName : IName, IDictionaryEdit 18 | { 19 | [ValidateStringLengthAtLeast(10)] 20 | [Group("A")]new string FirstName { get; set; } 21 | 22 | [ValidateStringLengthAtLeast(15)] 23 | [Group("B")]new string LastName { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/NonInheritableWithArray2Attribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | #if FEATURE_SERIALIZATION 20 | [Serializable] 21 | #endif 22 | [AttributeUsage(AttributeTargets.All, Inherited = false)] 23 | public class NonInheritableWithArray2Attribute : Attribute 24 | { 25 | public string[] Values; 26 | } 27 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IGenericInterfaceWithGenericMethodWithCascadingConstraintOnClass.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IGenericInterfaceWithGenericMethodWithCascadingConstraintOnClass 18 | where TGenericType : Empty 19 | { 20 | void Method() where TGenericSubType : TGenericType; 21 | } 22 | } -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Tokens/MethodBaseMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tokens 16 | { 17 | using System; 18 | using System.Reflection; 19 | 20 | internal static class MethodBaseMethods 21 | { 22 | public static readonly MethodInfo GetMethodFromHandle = 23 | typeof(MethodBase).GetMethod("GetMethodFromHandle", new[] { typeof(RuntimeMethodHandle), typeof(RuntimeTypeHandle) }); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/NonInheritableWithArrayAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | #if FEATURE_SERIALIZATION 20 | [Serializable] 21 | #endif 22 | [AttributeUsage(AttributeTargets.All, Inherited = false)] 23 | public class NonInheritableWithArrayAttribute : Attribute 24 | { 25 | public string[] Values { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/ComInteropTypes/ADODB/README.md: -------------------------------------------------------------------------------- 1 | # Note about the types defined in `Castle.DynamicProxy.Tests.ComInteropTypes.ADODB` 2 | 3 | The `Castle.DynamicProxy.Tests.ComInteropTypes.ADODB` namespace contains COM interop type declarations that have been extracted from a COM interop assembly, `ADODB.dll`, which is generally available on Windows systems. 4 | 5 | These interop type definitions are incomplete, and that they may contain inaccuracies. They are only reproduced to the approximate extent necessary to run the tests depending on them. Hints (in the form of code comments) are given where omissions or truncations were made. 6 | 7 | We used to reference types in the original `ADODB.dll` directly. The reason why we no longer do this, but instead reproduce the types here, is that the DLL is bound against the .NET Framework 3.5 DLL, while our test projects target .NET Framework 4.x. This can lead to assembly load failure e.g. on our Mono/Linux CI build. By moving the COM interop type definitions into this project, we can get rid of stale .NET 3.5 assembly references. 8 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IGenericInterfaceWithGenericMethodWithCascadingConstraintOnInterface.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IGenericInterfaceWithGenericMethodWithCascadingConstraintOnInterface 18 | where TGenericType : IEmpty 19 | { 20 | void Method() where TGenericSubType : TGenericType; 21 | } 22 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/ClassCallingVirtualMethodFromCtor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | namespace Castle.DynamicProxy.Tests.Classes 15 | { 16 | public class ClassCallingVirtualMethodFromCtor 17 | { 18 | public int Result; 19 | 20 | public ClassCallingVirtualMethodFromCtor() 21 | { 22 | Result = VirtualMethod(); 23 | } 24 | 25 | public virtual int VirtualMethod() 26 | { 27 | return 7; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/GenInterfaceWithGenMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | public interface GenInterfaceWithGenMethods 18 | { 19 | void DoSomething(Z z, T t); 20 | } 21 | 22 | public class GenInterfaceWithGenMethodsImpl : GenInterfaceWithGenMethods 23 | { 24 | public void DoSomething(Z z, T t) 25 | { 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/ISimple.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface ISimple 18 | { 19 | void Method(); 20 | } 21 | 22 | public class Simple : ISimple 23 | { 24 | private int count; 25 | 26 | public int Count 27 | { 28 | get { return count; } 29 | } 30 | 31 | public void Method() 32 | { 33 | count++; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/NestedNonInheritableAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2022 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | public partial class Nested 20 | { 21 | #if FEATURE_SERIALIZATION 22 | [Serializable] 23 | #endif 24 | [AttributeUsage(AttributeTargets.All, Inherited = false)] 25 | public class NonInheritableAttribute : Attribute 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IGenericInterfaceWithGenericMethodWithCascadingConstraintOnAnyReferenceType.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IGenericInterfaceWithGenericMethodWithCascadingConstraintOnAnyReferenceType 18 | where TGenericType : class 19 | { 20 | void Method() where TGenericSubType : TGenericType; 21 | } 22 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests.WeakNamed/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/VirtualClassWithNoDefaultCtor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class VirtualClassWithNoDefaultCtor 18 | { 19 | private readonly int result; 20 | 21 | public VirtualClassWithNoDefaultCtor(int result) 22 | { 23 | this.result = result; 24 | } 25 | 26 | public virtual int Method() 27 | { 28 | return result; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenClasses/OnlyGenMethodsClass.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenClasses 16 | { 17 | public class OnlyGenMethodsClass 18 | { 19 | private bool invoked; 20 | 21 | public bool Invoked 22 | { 23 | get { return invoked; } 24 | } 25 | 26 | public virtual Z DoSomething(Z z) where Z : new() 27 | { 28 | invoked = true; 29 | 30 | return new Z(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/OnlyGenMethodsInterface.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | public interface OnlyGenMethodsInterface 18 | { 19 | Z DoSomething(Z z) where Z : new(); 20 | } 21 | 22 | public class OnlyGenMethodsInterfaceImpl : OnlyGenMethodsInterface 23 | { 24 | public Z DoSomething(Z z) where Z : new() 25 | { 26 | return z; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IName.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | [TestDictionaryValidator] 18 | public interface IName : IDictionaryAdapter, IDictionaryNotify, IDictionaryCreate, IDictionaryValidate 19 | { 20 | string FirstName { get; } 21 | string LastName { get; } 22 | 23 | [StringFormat("{0} {1}", "FirstName,LastName")] 24 | string FullName { get; } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/Components.DictionaryAdapter.Tests/IPersonWithDeniedInheritancePrefix.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Tests 16 | { 17 | [KeyPrefix("")] 18 | [KeySubstitution("_", " ")] 19 | public interface IPersonWithDeniedInheritancePrefix : IPersonWithPrefixOverrideFurtherOverride 20 | { 21 | int NumberOfFingers { get; set; } 22 | 23 | [SuppressNotifications] 24 | int Max_Width { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interceptors/AssertCannotChangeTargetInterceptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interceptors 16 | { 17 | using NUnit.Framework; 18 | 19 | public class AssertCannotChangeTargetInterceptor : IInterceptor 20 | { 21 | public void Intercept(IInvocation invocation) 22 | { 23 | Assert.IsNotInstanceOf(invocation); 24 | invocation.Proceed(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Cursors/Base/IXmlCursor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | using System; 18 | 19 | public interface IXmlCursor : IXmlIterator 20 | { 21 | void Reset(); 22 | void MoveTo(IXmlNode node); 23 | void MoveToEnd(); 24 | 25 | void Create(Type type); 26 | void Coerce(Type type); 27 | void Remove(); 28 | void RemoveAllNext(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenClasses/GenClassWithConstraints.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenClasses 16 | { 17 | using System; 18 | 19 | public class GenClassWithConstraints where T : IComparable 20 | { 21 | private bool invoked; 22 | 23 | public bool Invoked 24 | { 25 | get { return invoked; } 26 | } 27 | 28 | public virtual void DoSomething() 29 | { 30 | invoked = true; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/ClassWithExplicitInterface.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | #if FEATURE_SERIALIZATION 20 | [Serializable] 21 | #endif 22 | public class ClassWithExplicitInterface : ISimpleInterface 23 | { 24 | int ISimpleInterface.Do() 25 | { 26 | return 5; 27 | } 28 | 29 | public virtual int DoVirtual() 30 | { 31 | return 7; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/NonPublicConstructorClass.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class NonPublicConstructorClass 18 | { 19 | protected NonPublicConstructorClass() 20 | { 21 | } 22 | 23 | public virtual void DoSomething() 24 | { 25 | } 26 | 27 | public static NonPublicConstructorClass Create() 28 | { 29 | return new NonPublicConstructorClass(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Explicit/SimpleInterfaceExplicit.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Explicit 16 | { 17 | using System; 18 | 19 | #if FEATURE_SERIALIZATION 20 | [Serializable] 21 | #endif 22 | public class SimpleInterfaceExplicit : ISimpleInterface 23 | { 24 | int ISimpleInterface.Do() 25 | { 26 | return 5; 27 | } 28 | 29 | public virtual int DoVirtual() 30 | { 31 | return 7; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/IGenericInterfaceWithGenericMethodWithCascadingConstraintOnAnyTypeWithDefaultConstructor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | public interface IGenericInterfaceWithGenericMethodWithCascadingConstraintOnAnyTypeWithDefaultConstructor 18 | where TGenericType : new() 19 | { 20 | void Method() where TGenericSubType : TGenericType; 21 | } 22 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/IndirectDelegateHolder.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | #if FEATURE_SERIALIZATION 16 | 17 | namespace Castle.DynamicProxy.Tests.Serialization 18 | { 19 | using System; 20 | 21 | [Serializable] 22 | public class IndirectDelegateHolder 23 | { 24 | public DelegateHolder DelegateHolder = new DelegateHolder(); 25 | 26 | public void TestHandler(object sender, EventArgs e) 27 | { 28 | } 29 | } 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Namespaces/Xsd.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | public static class Xsd 18 | { 19 | public const string 20 | Prefix = "xsd", 21 | NamespaceUri = "http://www.w3.org/2001/XMLSchema"; 22 | 23 | internal static readonly XmlNamespaceAttribute 24 | Namespace = new XmlNamespaceAttribute(NamespaceUri, Prefix) { Root = true }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Interfaces/ISharedName.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Interfaces 16 | { 17 | namespace A 18 | { 19 | public interface ISharedName 20 | { 21 | void M(); 22 | } 23 | } 24 | 25 | namespace B 26 | { 27 | public interface ISharedName 28 | { 29 | void M(); 30 | } 31 | } 32 | 33 | namespace C 34 | { 35 | public interface ISharedName 36 | { 37 | void M(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Attributes/VolatileAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System; 18 | 19 | /// 20 | /// Indicates that underlying values are changeable and should not be cached. 21 | /// 22 | [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Property, AllowMultiple = false)] 23 | public class VolatileAttribute : Attribute 24 | { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/BugsReported/DynProxy132.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.BugsReported 16 | { 17 | using Castle.DynamicProxy.Tests.Interfaces; 18 | 19 | using NUnit.Framework; 20 | 21 | [TestFixture] 22 | public class DynProxy132 : BasePEVerifyTestCase 23 | { 24 | [Test] 25 | public void ShouldGenerateTypeWithIndexers() 26 | { 27 | generator.CreateInterfaceProxyWithoutTarget(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/ClassToSerialize.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | using System; 18 | 19 | public class ClassToSerialize 20 | { 21 | private int id; 22 | private string name; 23 | 24 | public int Id 25 | { 26 | get { return id; } 27 | set { id = value; } 28 | } 29 | 30 | public string Name 31 | { 32 | get { return name; } 33 | set { name = value; } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Attributes/ReferenceAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System; 18 | 19 | /// 20 | /// Specifies assignment by reference rather than by copying. 21 | /// 22 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Interface)] 23 | public class ReferenceAttribute : Attribute 24 | { 25 | // Marker attribute; no functionality 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/InterClasses/WithRefOut.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.InterClasses 16 | { 17 | using System; 18 | 19 | using Castle.DynamicProxy.Tests.Interfaces; 20 | 21 | #if FEATURE_SERIALIZATION 22 | [Serializable] 23 | #endif 24 | public class WithRefOut : IWithRefOut 25 | { 26 | public void Do(out int i) 27 | { 28 | i = 5; 29 | } 30 | 31 | public void Did(ref int i) 32 | { 33 | i = 5; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/SerializableExplicitImpl.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | #if FEATURE_SERIALIZATION 16 | 17 | namespace Castle.DynamicProxy.Tests.Serialization 18 | { 19 | using System; 20 | using System.Runtime.Serialization; 21 | 22 | [Serializable] 23 | public class SerializableExplicitImpl : ISerializable 24 | { 25 | void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) 26 | { 27 | } 28 | } 29 | } 30 | 31 | #endif -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Tokens/TypeMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tokens 16 | { 17 | using System; 18 | using System.Reflection; 19 | 20 | internal static class TypeMethods 21 | { 22 | public static readonly MethodInfo GetTypeFromHandle = typeof(Type).GetMethod("GetTypeFromHandle"); 23 | 24 | public static readonly MethodInfo StaticGetType = typeof(Type).GetMethod("GetType", new[] { typeof(string), typeof(bool), typeof(bool) }); 25 | } 26 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenClasses/ClassWithIndexer.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenClasses 16 | { 17 | using System.Collections.Generic; 18 | 19 | public class ClassWithIndexer 20 | { 21 | private Dictionary map = new Dictionary(); 22 | 23 | public virtual TVal this[TKey key] 24 | { 25 | get { return map[key]; } 26 | set 27 | { 28 | map[key] = value; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Mixins/ClassImplementingIDerivedSImpleMixin.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Mixins 16 | { 17 | using System; 18 | 19 | #if FEATURE_SERIALIZATION 20 | [Serializable] 21 | #endif 22 | public class ClassImplementingIDerivedSimpleMixin : IDerivedSimpleMixin 23 | { 24 | public int DoSomething() 25 | { 26 | return 3; 27 | } 28 | 29 | public int DoSomethingDerived() 30 | { 31 | return 2; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Mixins/SimpleMixin.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Mixins 16 | { 17 | using System; 18 | 19 | public interface ISimpleMixin 20 | { 21 | int DoSomething(); 22 | } 23 | 24 | #if FEATURE_SERIALIZATION 25 | [Serializable] 26 | #endif 27 | public class SimpleMixin : ISimpleMixin 28 | { 29 | public SimpleMixin() 30 | { 31 | } 32 | 33 | public int DoSomething() 34 | { 35 | return 1; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/BadSerializable.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | #if FEATURE_SERIALIZATION 16 | 17 | namespace Castle.DynamicProxy.Tests.Serialization 18 | { 19 | using System; 20 | using System.Runtime.Serialization; 21 | 22 | [Serializable] 23 | public abstract class BadSerializable 24 | { 25 | public int Value { get; set; } 26 | 27 | public abstract void GetObjectData(SerializationInfo info, StreamingContext context); 28 | } 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/GenInterfaces/GenInterfaceWithGenMethodsAndGenReturn.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.GenInterfaces 16 | { 17 | public interface GenInterfaceWithGenMethodsAndGenReturn 18 | { 19 | Z DoSomething(Z z, T t); 20 | } 21 | 22 | public class GenInterfaceWithGenMethodsAndGenReturnImpl : GenInterfaceWithGenMethodsAndGenReturn 23 | { 24 | public Z DoSomething(Z z, T t) 25 | { 26 | return z; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Classes/ClassWithDefaultConstructor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Tests.Classes 16 | { 17 | public class ClassWithDefaultConstructor 18 | { 19 | public ClassWithDefaultConstructor() 20 | { 21 | _someString = "Something"; 22 | } 23 | 24 | private string _someString = string.Empty; 25 | 26 | public string SomeString 27 | { 28 | get { return _someString; } 29 | set { _someString = value; } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/DelegateHolder.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | #if FEATURE_SERIALIZATION 16 | 17 | namespace Castle.DynamicProxy.Tests.Serialization 18 | { 19 | using System; 20 | using System.Collections; 21 | 22 | [Serializable] 23 | public class DelegateHolder 24 | { 25 | public ArrayList ComplexTypeMember; 26 | public EventHandler DelegateMember; 27 | 28 | public void TestHandler(object sender, EventArgs e) 29 | { 30 | } 31 | } 32 | } 33 | 34 | #endif -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/IDictionaryBehaviorBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System.Collections.Generic; 18 | 19 | /// 20 | /// Defines the contract for building s. 21 | /// 22 | public interface IDictionaryBehaviorBuilder 23 | { 24 | /// 25 | /// Builds the dictionary behaviors. 26 | /// 27 | object[] BuildBehaviors(); 28 | } 29 | } -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Namespaces/Wsdl.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter.Xml 16 | { 17 | // Namespace for Guid type 18 | public static class Wsdl 19 | { 20 | public const string 21 | Prefix = "wsdl", 22 | NamespaceUri = "http://microsoft.com/wsdl/types/"; 23 | 24 | internal static readonly XmlNamespaceAttribute 25 | Namespace = new XmlNamespaceAttribute(NamespaceUri, Prefix) { Root = true }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Castle.Core.Tests/DynamicProxy.Tests/Serialization/ClassWithIndirectSelfReference.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | #if FEATURE_SERIALIZATION 16 | 17 | namespace Castle.DynamicProxy.Tests.Serialization 18 | { 19 | using System; 20 | using System.Collections; 21 | 22 | [Serializable] 23 | public class ClassWithIndirectSelfReference 24 | { 25 | public ArrayList List = new ArrayList(); 26 | 27 | public ClassWithIndirectSelfReference() 28 | { 29 | List.Add(this); 30 | } 31 | } 32 | } 33 | 34 | #endif -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/IDictionaryReferenceManager.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System; 18 | 19 | public interface IDictionaryReferenceManager 20 | { 21 | bool IsReferenceProperty(IDictionaryAdapter dictionaryAdapter, string propertyName); 22 | 23 | bool TryGetReference(object keyObject, out object inGraphObject); 24 | void AddReference(object keyObject, object relatedObject, bool isInGraph); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Castle.Core/Components.DictionaryAdapter/Util/IVirtual.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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.f 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace Castle.Components.DictionaryAdapter 16 | { 17 | using System; 18 | 19 | public interface IVirtual 20 | { 21 | bool IsReal { get; } 22 | 23 | void Realize(); 24 | 25 | event EventHandler Realized; 26 | } 27 | 28 | public interface IVirtual : IVirtual 29 | { 30 | new T Realize(); 31 | 32 | void AddSite(IVirtualSite site); 33 | 34 | void RemoveSite(IVirtualSite site); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/NullExpression.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST 16 | { 17 | using System.Reflection.Emit; 18 | 19 | internal class NullExpression : IExpression 20 | { 21 | public static readonly NullExpression Instance = new NullExpression(); 22 | 23 | protected NullExpression() 24 | { 25 | } 26 | 27 | public void Emit(ILGenerator gen) 28 | { 29 | gen.Emit(OpCodes.Ldnull); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Castle.Core/Properties/InternalsVisibleToTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2004-2021 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. 14 | 15 | using System.Runtime.CompilerServices; 16 | 17 | [assembly: InternalsVisibleTo("Castle.Core.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010077f5e87030dadccce6902c6adab7a987bd69cb5819991531f560785eacfc89b6fcddf6bb2a00743a7194e454c0273447fc6eec36474ba8e5a3823147d214298e4f9a631b1afee1a51ffeae4672d498f14b000e3d321453cdd8ac064de7e1cf4d222b7e81f54d4fd46725370d702a05b48738cc29d09228f1aa722ae1a9ca02fb")] 18 | --------------------------------------------------------------------------------