Skip to content

Commit 834caae

Browse files
[FSSDK-11546] lint fix
1 parent 68b7f22 commit 834caae

File tree

3 files changed

+93
-90
lines changed

3 files changed

+93
-90
lines changed

OptimizelySDK.Tests/BucketerHoldoutTest.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ public class BucketerHoldoutTest
4242
public void Initialize()
4343
{
4444
LoggerMock = new Mock<ILogger>();
45-
45+
4646
// Load holdout test data
4747
var testDataPath = Path.Combine(TestContext.CurrentContext.TestDirectory,
4848
"TestData", "HoldoutTestData.json");
4949
var jsonContent = File.ReadAllText(testDataPath);
5050
TestData = JObject.Parse(jsonContent);
51-
51+
5252
// Use datafile with holdouts for proper config setup
5353
var datafileWithHoldouts = TestData["datafileWithHoldouts"].ToString();
5454
Config = DatafileProjectConfig.Create(datafileWithHoldouts, LoggerMock.Object,
5555
new ErrorHandler.NoOpErrorHandler());
5656
TestBucketer = new TestBucketer(LoggerMock.Object);
57-
57+
5858
// Verify that the config contains holdouts
5959
Assert.IsNotNull(Config.Holdouts, "Config should have holdouts");
6060
Assert.IsTrue(Config.Holdouts.Length > 0, "Config should contain holdouts");
@@ -76,10 +76,10 @@ public void TestBucketHoldout_ValidTrafficAllocation()
7676
Assert.IsNotNull(result.ResultObject);
7777
Assert.AreEqual("var_1", result.ResultObject.Id);
7878
Assert.AreEqual("control", result.ResultObject.Key);
79-
79+
8080
// Verify logging
81-
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
82-
It.Is<string>(s => s.Contains($"Assigned bucket [2500] to user [{TestUserId}]"))),
81+
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
82+
It.Is<string>(s => s.Contains($"Assigned bucket [2500] to user [{TestUserId}]"))),
8383
Times.Once);
8484
}
8585

@@ -89,7 +89,7 @@ public void TestBucketHoldout_UserOutsideAllocation()
8989
// Test user not bucketed when outside traffic allocation range
9090
var holdoutJson = TestData["globalHoldout"].ToString();
9191
var holdout = JsonConvert.DeserializeObject<Holdout>(holdoutJson);
92-
92+
9393
// Modify traffic allocation to be smaller (0-1000 range = 10%)
9494
holdout.TrafficAllocation[0].EndOfRange = 1000;
9595

@@ -100,10 +100,10 @@ public void TestBucketHoldout_UserOutsideAllocation()
100100

101101
Assert.IsNull(result.ResultObject.Id);
102102
Assert.IsNull(result.ResultObject.Key);
103-
103+
104104
// Verify user was assigned bucket value but no variation was found
105-
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
106-
It.Is<string>(s => s.Contains($"Assigned bucket [1500] to user [{TestUserId}]"))),
105+
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
106+
It.Is<string>(s => s.Contains($"Assigned bucket [1500] to user [{TestUserId}]"))),
107107
Times.Once);
108108
}
109109

@@ -113,7 +113,7 @@ public void TestBucketHoldout_NoTrafficAllocation()
113113
// Test holdout with empty traffic allocation
114114
var holdoutJson = TestData["globalHoldout"].ToString();
115115
var holdout = JsonConvert.DeserializeObject<Holdout>(holdoutJson);
116-
116+
117117
// Clear traffic allocation
118118
holdout.TrafficAllocation = new TrafficAllocation[0];
119119

@@ -123,10 +123,10 @@ public void TestBucketHoldout_NoTrafficAllocation()
123123

124124
Assert.IsNull(result.ResultObject.Id);
125125
Assert.IsNull(result.ResultObject.Key);
126-
126+
127127
// Verify bucket was assigned but no variation found
128-
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
129-
It.Is<string>(s => s.Contains($"Assigned bucket [5000] to user [{TestUserId}]"))),
128+
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
129+
It.Is<string>(s => s.Contains($"Assigned bucket [5000] to user [{TestUserId}]"))),
130130
Times.Once);
131131
}
132132

@@ -136,7 +136,7 @@ public void TestBucketHoldout_InvalidVariationId()
136136
// Test holdout with invalid variation ID in traffic allocation
137137
var holdoutJson = TestData["globalHoldout"].ToString();
138138
var holdout = JsonConvert.DeserializeObject<Holdout>(holdoutJson);
139-
139+
140140
// Set traffic allocation to point to non-existent variation
141141
holdout.TrafficAllocation[0].EntityId = "invalid_variation_id";
142142

@@ -146,10 +146,10 @@ public void TestBucketHoldout_InvalidVariationId()
146146

147147
Assert.IsNull(result.ResultObject.Id);
148148
Assert.IsNull(result.ResultObject.Key);
149-
149+
150150
// Verify bucket was assigned
151-
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
152-
It.Is<string>(s => s.Contains($"Assigned bucket [5000] to user [{TestUserId}]"))),
151+
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
152+
It.Is<string>(s => s.Contains($"Assigned bucket [5000] to user [{TestUserId}]"))),
153153
Times.Once);
154154
}
155155

@@ -167,10 +167,10 @@ public void TestBucketHoldout_EmptyVariations()
167167

168168
Assert.IsNull(result.ResultObject.Id);
169169
Assert.IsNull(result.ResultObject.Key);
170-
170+
171171
// Verify bucket was assigned
172-
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
173-
It.Is<string>(s => s.Contains($"Assigned bucket [5000] to user [{TestUserId}]"))),
172+
LoggerMock.Verify(l => l.Log(LogLevel.DEBUG,
173+
It.Is<string>(s => s.Contains($"Assigned bucket [5000] to user [{TestUserId}]"))),
174174
Times.Once);
175175
}
176176

@@ -180,7 +180,7 @@ public void TestBucketHoldout_EmptyExperimentKey()
180180
// Test holdout with empty key
181181
var holdoutJson = TestData["globalHoldout"].ToString();
182182
var holdout = JsonConvert.DeserializeObject<Holdout>(holdoutJson);
183-
183+
184184
// Clear holdout key
185185
holdout.Key = "";
186186

@@ -200,7 +200,7 @@ public void TestBucketHoldout_NullExperimentKey()
200200
// Test holdout with null key
201201
var holdoutJson = TestData["globalHoldout"].ToString();
202202
var holdout = JsonConvert.DeserializeObject<Holdout>(holdoutJson);
203-
203+
204204
// Set holdout key to null
205205
holdout.Key = null;
206206

@@ -220,7 +220,7 @@ public void TestBucketHoldout_MultipleVariationsInRange()
220220
// Test holdout with multiple variations and user buckets into first one
221221
var holdoutJson = TestData["globalHoldout"].ToString();
222222
var holdout = JsonConvert.DeserializeObject<Holdout>(holdoutJson);
223-
223+
224224
// Add a second variation
225225
var variation2 = new Variation
226226
{
@@ -229,7 +229,7 @@ public void TestBucketHoldout_MultipleVariationsInRange()
229229
FeatureEnabled = true
230230
};
231231
holdout.Variations = new[] { holdout.Variations[0], variation2 };
232-
232+
233233
// Set traffic allocation for first variation (0-5000) and second (5000-10000)
234234
holdout.TrafficAllocation = new[]
235235
{
@@ -253,7 +253,7 @@ public void TestBucketHoldout_MultipleVariationsInSecondRange()
253253
// Use the global holdout from config which now has multiple variations
254254
var holdout = Config.GetHoldout("holdout_global_1");
255255
Assert.IsNotNull(holdout, "Holdout should exist in config");
256-
256+
257257
// Verify holdout has multiple variations
258258
Assert.IsTrue(holdout.Variations.Length >= 2, "Holdout should have multiple variations");
259259
Assert.AreEqual("var_1", holdout.Variations[0].Id);
@@ -274,7 +274,7 @@ public void TestBucketHoldout_EdgeCaseBoundaryValues()
274274
// Test edge cases at traffic allocation boundaries
275275
var holdoutJson = TestData["globalHoldout"].ToString();
276276
var holdout = JsonConvert.DeserializeObject<Holdout>(holdoutJson);
277-
277+
278278
// Set traffic allocation to 5000 (50%)
279279
holdout.TrafficAllocation[0].EndOfRange = 5000;
280280

@@ -308,7 +308,7 @@ public void TestBucketHoldout_ConsistentBucketingWithSameInputs()
308308
// Results should be identical
309309
Assert.IsNotNull(result1);
310310
Assert.IsNotNull(result2);
311-
311+
312312
if (result1.ResultObject?.Id != null)
313313
{
314314
Assert.AreEqual(result1.ResultObject.Id, result2.ResultObject.Id);

0 commit comments

Comments
 (0)