Skip to content

Commit 0fa28ad

Browse files
committed
Made Set protected - you shouldn't call it from outside a builder
1 parent fcf38b8 commit 0fa28ad

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

NTestDataBuilder.Tests/Builders/BasicCustomerBuilder.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using NTestDataBuilder.Tests.Entities;
1+
using System;
2+
using System.Linq.Expressions;
3+
using NTestDataBuilder.Tests.Entities;
24

35
namespace NTestDataBuilder.Tests.Builders
46
{
@@ -8,5 +10,10 @@ protected override Customer BuildObject()
810
{
911
return new Customer("First Name", "Last Name", 2013);
1012
}
13+
14+
public new BasicCustomerBuilder Set<TValue>(Expression<Func<Customer, TValue>> property, TValue value)
15+
{
16+
return base.Set(property, value);
17+
}
1118
}
1219
}

NTestDataBuilder.Tests/NTestDataBuilder.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
<Reference Include="FizzWare.NBuilder">
3535
<HintPath>..\packages\NBuilder.3.0.1.1\lib\FizzWare.NBuilder.dll</HintPath>
3636
</Reference>
37-
<Reference Include="NSubstitute, Version=1.6.0.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca, processorArchitecture=MSIL">
37+
<Reference Include="NSubstitute, Version=1.7.2.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca, processorArchitecture=MSIL">
3838
<SpecificVersion>False</SpecificVersion>
39-
<HintPath>..\packages\NSubstitute.1.6.0.0\lib\NET40\NSubstitute.dll</HintPath>
39+
<HintPath>..\packages\NSubstitute.1.7.2.0\lib\NET40\NSubstitute.dll</HintPath>
4040
</Reference>
4141
<Reference Include="nunit.framework">
4242
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>

NTestDataBuilder/NTestDataBuilder.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
<Reference Include="FizzWare.NBuilder">
3737
<HintPath>..\packages\NBuilder.3.0.1.1\lib\FizzWare.NBuilder.dll</HintPath>
3838
</Reference>
39-
<Reference Include="NSubstitute">
40-
<HintPath>..\packages\NSubstitute.1.6.0.0\lib\NET40\NSubstitute.dll</HintPath>
39+
<Reference Include="NSubstitute, Version=1.7.2.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca, processorArchitecture=MSIL">
40+
<SpecificVersion>False</SpecificVersion>
41+
<HintPath>..\packages\NSubstitute.1.7.2.0\lib\NET40\NSubstitute.dll</HintPath>
4142
</Reference>
4243
<Reference Include="Ploeh.AutoFixture">
4344
<HintPath>..\packages\AutoFixture.3.20.0\lib\net40\Ploeh.AutoFixture.dll</HintPath>

NTestDataBuilder/TestDataBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected virtual void AlterProxy(TObject proxy) {}
8888
/// <typeparam name="TValue">The type of the property</typeparam>
8989
/// <param name="property">A lambda expression specifying the property to record a value for</param>
9090
/// <param name="value">The value to record</param>
91-
public TBuilder Set<TValue>(Expression<Func<TObject, TValue>> property, TValue value)
91+
protected TBuilder Set<TValue>(Expression<Func<TObject, TValue>> property, TValue value)
9292
{
9393
_properties[PropertyNameGetter.Get(property)] = value;
9494
return this as TBuilder;

0 commit comments

Comments
 (0)