Skip to content

Commit a568a45

Browse files
[FSSDK-11177] format fix
1 parent 40843ac commit a568a45

5 files changed

Lines changed: 46 additions & 44 deletions

File tree

OptimizelySDK.Tests/CmabTests/DecisionServiceCmabTest.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,10 @@ public void TestGetDecisionForCmabExperimentAttributeFiltering()
528528
cmabClientMock.VerifyAll();
529529
}
530530

531-
/// <summary>
532-
/// Verifies CMAB service receives an empty attribute payload when no CMAB attribute IDs are configured
533-
/// </summary>
531+
/// <summary>
532+
/// Verifies CMAB service receives an empty attribute payload when no CMAB attribute IDs are
533+
/// configured
534+
/// </summary>
534535
[Test]
535536
public void TestGetDecisionForCmabExperimentNoAttributeIds()
536537
{

OptimizelySDK.Tests/CmabTests/OptimizelyUserContextCmabTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ namespace OptimizelySDK.Tests.CmabTests
4040
public class OptimizelyUserContextCmabTest
4141
{
4242
private Mock<ILogger> _loggerMock;
43-
private Mock<IErrorHandler> _errorHandlerMock;
44-
private Mock<IEventDispatcher> _eventDispatcherMock;
45-
private TestCmabService _cmabService;
43+
private Mock<IErrorHandler> _errorHandlerMock;
44+
private Mock<IEventDispatcher> _eventDispatcherMock;
45+
private TestCmabService _cmabService;
4646
private Mock<TestNotificationCallbacks> _notificationCallbackMock;
4747
private Optimizely _optimizely;
4848
private ProjectConfig _config;
@@ -548,7 +548,8 @@ private class TestCmabService : ICmabService
548548

549549
public bool ReturnNullNext { get; set; }
550550

551-
public Func<ProjectConfig, OptimizelyUserContext, string, OptimizelyDecideOption[], CmabDecision>
551+
public Func<ProjectConfig, OptimizelyUserContext, string, OptimizelyDecideOption[],
552+
CmabDecision>
552553
Handler { get; set; }
553554

554555
public void EnqueueDecision(CmabDecision decision)

OptimizelySDK/Bucketing/Bucketer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public virtual Result<string> BucketToEntityId(ProjectConfig config, Experiment
160160

161161
// Bucket user with provided traffic allocations
162162
var entityId = FindBucket(bucketingId, userId, experiment.Id, trafficAllocations);
163-
163+
164164
if (string.IsNullOrEmpty(entityId))
165165
{
166166
return Result<string>.NullResult(reasons);
Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,51 @@
1-
/*
2-
* Copyright 2025, Optimizely
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
/*
2+
* Copyright 2025, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616

1717
using OptimizelySDK.Entity;
1818

1919
namespace OptimizelySDK.Bucketing
2020
{
2121
/// <summary>
22-
/// Represents the result of a variation decision, including CMAB-specific fields.
22+
/// Represents the result of a variation decision, including CMAB-specific fields.
2323
/// </summary>
2424
public class VariationDecisionResult
2525
{
26+
public VariationDecisionResult(Variation variation, string cmabUuid = null,
27+
bool cmabError = false
28+
)
29+
{
30+
Variation = variation;
31+
CmabUuid = cmabUuid;
32+
CmabError = cmabError;
33+
}
34+
2635
/// <summary>
27-
/// The variation selected for the user. Null if no variation was selected.
36+
/// The variation selected for the user. Null if no variation was selected.
2837
/// </summary>
2938
public Variation Variation { get; set; }
3039

3140
/// <summary>
32-
/// The CMAB UUID associated with this decision. Null for non-CMAB experiments.
41+
/// The CMAB UUID associated with this decision. Null for non-CMAB experiments.
3342
/// </summary>
3443
public string CmabUuid { get; set; }
3544

3645
/// <summary>
37-
/// Indicates whether an error occurred during the CMAB decision process.
38-
/// False for non-CMAB experiments or successful CMAB decisions.
46+
/// Indicates whether an error occurred during the CMAB decision process.
47+
/// False for non-CMAB experiments or successful CMAB decisions.
3948
/// </summary>
4049
public bool CmabError { get; set; }
41-
42-
public VariationDecisionResult(Variation variation, string cmabUuid = null, bool cmabError = false)
43-
{
44-
Variation = variation;
45-
CmabUuid = cmabUuid;
46-
CmabError = cmabError;
47-
}
4850
}
4951
}

OptimizelySDK/Cmab/DefaultCmabService.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,15 @@ public DefaultCmabService(LruCache<CmabCacheEntry> cmabCache,
110110
/// <param name="logger">Optional logger for recording service operations.</param>
111111
public DefaultCmabService(CmabConfig cmabConfig = null,
112112
ICmabClient cmabClient = null,
113-
ILogger logger = null)
113+
ILogger logger = null
114+
)
114115
{
115116
_logger = logger ?? new NoOpLogger();
116-
117-
// Create cache based on configuration
117+
118118
var config = cmabConfig ?? new CmabConfig();
119-
119+
120120
if (config.CustomCache != null)
121121
{
122-
// Use custom cache if provided
123122
_cmabCache = config.CustomCache as LruCache<CmabCacheEntry>;
124123
if (_cmabCache == null)
125124
{
@@ -129,17 +128,16 @@ public DefaultCmabService(CmabConfig cmabConfig = null,
129128
}
130129
else
131130
{
132-
// Use default or configured cache size and TTL
133131
var cacheSize = config.CacheSize ?? CmabConstants.DEFAULT_CACHE_SIZE;
134132
var cacheTtl = config.CacheTtl ?? CmabConstants.DEFAULT_CACHE_TTL;
135133
_cmabCache = new LruCache<CmabCacheEntry>(cacheSize, cacheTtl, _logger);
136134
}
137-
135+
138136
// Create client if not provided
139137
if (cmabClient == null)
140138
{
141-
var cmabRetryConfig = new CmabRetryConfig(maxRetries: 1,
142-
initialBackoff: TimeSpan.FromMilliseconds(100));
139+
var cmabRetryConfig = new CmabRetryConfig(1,
140+
TimeSpan.FromMilliseconds(100));
143141
_cmabClient = new DefaultCmabClient(null, cmabRetryConfig, _logger);
144142
}
145143
else

0 commit comments

Comments
 (0)