Skip to content

Commit

Permalink
Rename BuilderName to Name (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk authored Jul 27, 2023
1 parent 7dc06c0 commit 19c0488
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/Polly.Core/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ Polly.ResilienceStrategyBuilder<TResult>
Polly.ResilienceStrategyBuilder<TResult>.Build() -> Polly.ResilienceStrategy<TResult>!
Polly.ResilienceStrategyBuilder<TResult>.ResilienceStrategyBuilder() -> void
Polly.ResilienceStrategyBuilderBase
Polly.ResilienceStrategyBuilderBase.BuilderName.get -> string?
Polly.ResilienceStrategyBuilderBase.BuilderName.set -> void
Polly.ResilienceStrategyBuilderBase.DiagnosticSource.get -> System.Diagnostics.DiagnosticSource?
Polly.ResilienceStrategyBuilderBase.DiagnosticSource.set -> void
Polly.ResilienceStrategyBuilderBase.InstanceName.get -> string?
Polly.ResilienceStrategyBuilderBase.InstanceName.set -> void
Polly.ResilienceStrategyBuilderBase.Name.get -> string?
Polly.ResilienceStrategyBuilderBase.Name.set -> void
Polly.ResilienceStrategyBuilderBase.OnCreatingStrategy.get -> System.Action<System.Collections.Generic.IList<Polly.ResilienceStrategy!>!>?
Polly.ResilienceStrategyBuilderBase.OnCreatingStrategy.set -> void
Polly.ResilienceStrategyBuilderBase.Properties.get -> Polly.ResilienceProperties!
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Registry/ResilienceStrategyRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private static ResilienceStrategy CreateStrategy<TBuilder>(
Func<TBuilder> factory = () =>
{
var builder = activator();
builder.BuilderName = context.BuilderName;
builder.Name = context.BuilderName;
builder.InstanceName = context.BuilderInstanceName;
configure(builder, context);
Expand Down
8 changes: 4 additions & 4 deletions src/Polly.Core/ResilienceStrategyBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private protected ResilienceStrategyBuilderBase()

private protected ResilienceStrategyBuilderBase(ResilienceStrategyBuilderBase other)
{
BuilderName = other.BuilderName;
Name = other.Name;
Properties = other.Properties;
TimeProvider = other.TimeProvider;
OnCreatingStrategy = other.OnCreatingStrategy;
Expand All @@ -41,14 +41,14 @@ private protected ResilienceStrategyBuilderBase(ResilienceStrategyBuilderBase ot
/// <value>
/// The default value is <see langword="null"/>.
/// </value>
public string? BuilderName { get; set; }
public string? Name { get; set; }

/// <summary>
/// Gets or sets the instance name of the builder.
/// </summary>
/// <remarks>
/// This property is also included in the telemetry that is produced by the individual resilience strategies.
/// The instance name can be used to differentiate between multiple builder instances with the same <see cref="BuilderName"/>.
/// The instance name can be used to differentiate between multiple builder instances with the same <see cref="Name"/>.
/// </remarks>
/// <value>
/// The default value is <see langword="null"/>.
Expand Down Expand Up @@ -161,7 +161,7 @@ internal ResilienceStrategy BuildStrategy()
private ResilienceStrategy CreateResilienceStrategy(Entry entry)
{
var context = new ResilienceStrategyBuilderContext(
builderName: BuilderName,
builderName: Name,
builderInstanceName: InstanceName,
builderProperties: Properties,
strategyName: entry.Options.Name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static TBuilder ConfigureTelemetry<TBuilder>(this TBuilder builder, Telem
{
var telemetryStrategy = new TelemetryResilienceStrategy(
TimeProvider.System,
builder.BuilderName,
builder.Name,
builder.InstanceName,
options.LoggerFactory,
options.ResultFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class GenericResilienceStrategyBuilderTests
[Fact]
public void Ctor_EnsureDefaults()
{
_builder.BuilderName.Should().BeNull();
_builder.Name.Should().BeNull();
_builder.Properties.Should().NotBeNull();
_builder.TimeProvider.Should().Be(TimeProvider.System);
_builder.OnCreatingStrategy.Should().BeNull();
Expand All @@ -25,8 +25,8 @@ public void CopyCtor_Ok()
[Fact]
public void Properties_GetSet_Ok()
{
_builder.BuilderName = "dummy";
_builder.BuilderName.Should().Be("dummy");
_builder.Name = "dummy";
_builder.Name.Should().Be("dummy");

var timeProvider = new FakeTimeProvider();
_builder.TimeProvider = timeProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public void AddBuilder_EnsureStrategyKey()
context.BuilderName.Should().Be("A");
context.BuilderInstanceName.Should().Be("Instance1");
builder.AddStrategy(new TestResilienceStrategy());
builder.BuilderName.Should().Be("A");
builder.Name.Should().Be("A");
called = true;
});

Expand Down Expand Up @@ -270,7 +270,7 @@ public void AddBuilder_Generic_EnsureStrategyKey()
registry.TryAddBuilder<string>(StrategyId.Create("A"), (builder, _) =>
{
builder.AddStrategy(new TestResilienceStrategy());
builder.BuilderName.Should().Be("A");
builder.Name.Should().Be("A");
builder.InstanceName.Should().Be("Instance1");
called = true;
});
Expand Down
8 changes: 4 additions & 4 deletions test/Polly.Core.Tests/ResilienceStrategyBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void Ctor_EnsureDefaults()
{
var builder = new ResilienceStrategyBuilder();

builder.BuilderName.Should().BeNull();
builder.Name.Should().BeNull();
builder.Properties.Should().NotBeNull();
builder.TimeProvider.Should().Be(TimeProvider.System);
builder.Randomizer.Should().NotBeNull();
Expand All @@ -25,7 +25,7 @@ public void CopyCtor_Ok()
var builder = new ResilienceStrategyBuilder
{
TimeProvider = Mock.Of<TimeProvider>(),
BuilderName = "dummy",
Name = "dummy",
Randomizer = () => 0.0,
DiagnosticSource = Mock.Of<DiagnosticSource>(),
OnCreatingStrategy = _ => { },
Expand All @@ -34,7 +34,7 @@ public void CopyCtor_Ok()
builder.Properties.Set(new ResiliencePropertyKey<string>("dummy"), "dummy");

var other = new ResilienceStrategyBuilder<double>(builder);
other.BuilderName.Should().Be(builder.BuilderName);
other.Name.Should().Be(builder.Name);
other.TimeProvider.Should().Be(builder.TimeProvider);
other.Randomizer.Should().BeSameAs(builder.Randomizer);
other.DiagnosticSource.Should().BeSameAs(builder.DiagnosticSource);
Expand Down Expand Up @@ -288,7 +288,7 @@ public void BuildStrategy_EnsureCorrectContext()

var builder = new ResilienceStrategyBuilder
{
BuilderName = "builder-name",
Name = "builder-name",
TimeProvider = new FakeTimeProvider(),
};

Expand Down

0 comments on commit 19c0488

Please sign in to comment.