Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Castle.Core.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.20827.3
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8C53C104-3557-4C1A-B653-C4E6C46DB48E}"
ProjectSection(SolutionItems) = preProject
Expand Down
17 changes: 12 additions & 5 deletions src/Castle.Core.Tests-SL/Castle.Core.Tests-SL.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<RootPath Condition=" '$(RootPath)' == '' ">$(MSBuildProjectDirectory)\..\..</RootPath>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<UpgradeBackupLocation />
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">SL50-Debug</Configuration>
Expand Down Expand Up @@ -100,7 +105,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'NET45-Debug|AnyCPU'">
<OutputPath>bin\NET45-Debug\</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
Expand Down Expand Up @@ -152,13 +157,15 @@
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.CSharp.targets" Condition="$(MSBuildTargets) == 'Silverlight 4.0'" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets" Condition="$(MSBuildTargets) == 'Silverlight 5.0'" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" Condition="$(MSBuildTargets) == 'Silverlight 4.0'" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets" Condition="$(MSBuildTargets) == 'Silverlight 5.0'" />
<Import Project="$(RootPath)\Settings.proj" />
<Import Project="$(BuildScriptsPath)\Castle.Common.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
1 change: 1 addition & 0 deletions src/Castle.Core.Tests/Castle.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
<Compile Include="BugsReported\DynProxy159.cs" />
<Compile Include="BugsReported\DynProxy145_SynchronizationContext.cs" />
<Compile Include="DynamicProxy.Tests\Classes\ClassWithMethodWithParameterWithDefaultValue.cs" />
<Compile Include="DynamicProxy.Tests\Classes\ClassWithMethodWithParameterWithNullDefaultValue.cs" />
<Compile Include="DynamicProxy.Tests\ClassProxyWithDefaultValuesTestCase.cs" />
<Compile Include="DynamicProxy.Tests\GenericInterfaceWithGenericMethod.cs" />
<Compile Include="MultipleSavedAssembliesTestCase.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace Castle.DynamicProxy.Tests

using Castle.DynamicProxy.Tests.Classes;

using CastleTests.DynamicProxy.Tests.Classes;

using NUnit.Framework;

[TestFixture]
Expand All @@ -34,6 +36,26 @@ public void MethodParameterWithDefaultValue_DefaultValueIsSetOnProxiedMethodAsWe
Assert.True(parameter.HasDefaultValue);
Assert.AreEqual(3, parameter.DefaultValue);
}

[Test]
public void MethodParameterWithDefaultValue_DefaultValueNullIsSetOnProxiedMethodAsWell()
{
var proxiedType = generator.CreateClassProxy<ClassWithMethodWithParameterWithNullDefaultValue>().GetType();

var parameter = proxiedType.GetMethod("Method").GetParameters().Single(paramInfo => paramInfo.Name == "value");


Assert.False(parameter.HasDefaultValue);
}

[Test]
public void MethodParameterWithDefaultValue_UseNullDefaultValue()
{
var proxiedType = generator.CreateClassProxy<ClassWithMethodWithParameterWithNullDefaultValue>();
var result = proxiedType.Method();

Assert.IsTrue(result);
}
#endif
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2004-2013 Castle Project - http://www.castleproject.org/
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace CastleTests.DynamicProxy.Tests.Classes
{
public class ClassWithMethodWithParameterWithNullDefaultValue
{
public virtual bool Method(int? value = null)
{
return value == null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void DefineParameters(ParameterInfo[] parameters)
parameterBuilder.SetCustomAttribute(attribute);
}
#if DOTNET45
if (parameter.HasDefaultValue)
if (parameter.HasDefaultValue && parameter.DefaultValue != null)
{
parameterBuilder.SetConstant(parameter.DefaultValue);
}
Expand Down