-
Notifications
You must be signed in to change notification settings - Fork 675
Expand file tree
/
Copy pathPreferenceSettingsTests.cs
More file actions
558 lines (489 loc) · 25.5 KB
/
Copy pathPreferenceSettingsTests.cs
File metadata and controls
558 lines (489 loc) · 25.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Dynamo.Configuration;
using Dynamo.Core;
using Dynamo.Interfaces;
using Dynamo.Models;
using Dynamo.Utilities;
using NUnit.Framework;
namespace Dynamo.Tests.Configuration
{
[TestFixture]
class PreferenceSettingsTests : UnitTestBase
{
[Test]
[Category("UnitTests")]
public void TestLoad()
{
string settingDirectory = Path.Combine(TestDirectory, "settings");
string settingsFilePath = Path.Combine(settingDirectory, "DynamoSettings-PythonTemplate-initial.xml");
// Assert files required for test exist
Assert.IsTrue(File.Exists(settingsFilePath));
var settings = PreferenceSettings.Load(settingsFilePath);
Assert.IsNotNull(settings);
}
[Test]
[Category("UnitTests")]
public void TestGetPythonTemplateFilePath()
{
string settingDirectory = Path.Combine(TestDirectory, "settings");
string settingsFilePath = Path.Combine(settingDirectory, "DynamoSettings-PythonTemplate-initial.xml");
string initialPyFilePath = Path.Combine(settingDirectory, @"PythonTemplate-initial.py");
// Assert files required for test exist
Assert.IsTrue(File.Exists(settingsFilePath));
Assert.IsTrue(File.Exists(initialPyFilePath));
PreferenceSettings.Load(settingsFilePath);
string pythonTemplateFilePath = Path.Combine(settingDirectory, PreferenceSettings.GetPythonTemplateFilePath());
Assert.AreEqual(pythonTemplateFilePath, initialPyFilePath);
}
[Test]
[Category("UnitTests")]
public void TestSettingsSerialization()
{
string tempPath = System.IO.Path.GetTempPath();
tempPath = Path.Combine(tempPath, "userPreference.xml");
PreferenceSettings settings = new PreferenceSettings();
// Assert defaults
Assert.AreEqual(settings.GetIsBackgroundPreviewActive("MyBackgroundPreview"), true);
Assert.AreEqual(settings.ShowCodeBlockLineNumber, true);
Assert.AreEqual(settings.ShowTabsAndSpacesInScriptEditor, false);
Assert.AreEqual(settings.EnableNodeAutoComplete, true);
Assert.AreEqual(settings.IsAutoSyncDocumentBrowser, true);
Assert.AreEqual(settings.EnableNotificationCenter, true);
Assert.AreEqual(settings.DefaultPythonEngine, string.Empty);
Assert.AreEqual(settings.MaxNumRecentFiles, PreferenceSettings.DefaultMaxNumRecentFiles);
Assert.AreEqual(settings.BackupInterval, PreferenceSettings.DefaultBackupInterval);
Assert.AreEqual(settings.UseHardwareAcceleration, true);
Assert.AreEqual(settings.ViewExtensionSettings.Count, 0);
Assert.AreEqual(settings.DefaultRunType, RunType.Automatic);
Assert.AreEqual(settings.DynamoPlayerFolderGroups.Count, 0);
Assert.AreEqual(settings.EnableDynamoPlayerRenamedWatchAsOutput, false);
Assert.AreEqual(settings.Locale, "Default");
// Save
settings.Save(tempPath);
settings = PreferenceSettings.Load(tempPath);
// Assert deserialized values are same when saved with defaults
Assert.AreEqual(settings.GetIsBackgroundPreviewActive("MyBackgroundPreview"), true);
Assert.AreEqual(settings.ShowCodeBlockLineNumber, true);
Assert.AreEqual(settings.ShowTabsAndSpacesInScriptEditor, false);
Assert.AreEqual(settings.EnableNodeAutoComplete, true);
Assert.AreEqual(settings.IsAutoSyncDocumentBrowser, true);
Assert.AreEqual(settings.EnableNotificationCenter, true);
Assert.AreEqual(settings.DefaultPythonEngine, string.Empty);
Assert.AreEqual(settings.MaxNumRecentFiles, PreferenceSettings.DefaultMaxNumRecentFiles);
Assert.AreEqual(settings.BackupInterval, PreferenceSettings.DefaultBackupInterval);
Assert.AreEqual(settings.UseHardwareAcceleration, true);
Assert.AreEqual(settings.ViewExtensionSettings.Count, 0);
Assert.AreEqual(settings.DefaultRunType, RunType.Automatic);
Assert.AreEqual(settings.DynamoPlayerFolderGroups.Count, 0);
Assert.AreEqual(settings.EnableDynamoPlayerRenamedWatchAsOutput, false);
Assert.AreEqual(settings.Locale, "Default");
// Change setting values
settings.SetIsBackgroundPreviewActive("MyBackgroundPreview", false);
settings.ShowCodeBlockLineNumber = false;
settings.ShowTabsAndSpacesInScriptEditor = true;
settings.DefaultPythonEngine = "CP3";
settings.MaxNumRecentFiles = 24;
settings.BackupInterval = 120000; //change to 2 minutes(120000 ms)
settings.UseHardwareAcceleration = false;
settings.EnableNodeAutoComplete = false;
settings.IsAutoSyncDocumentBrowser = false;
settings.EnableNotificationCenter = false;
settings.DefaultRunType = RunType.Manual;
settings.ViewExtensionSettings.Add(new ViewExtensionSettings()
{
Name = "MyExtension",
UniqueId = "1234",
DisplayMode = ViewExtensionDisplayMode.FloatingWindow,
WindowSettings = new WindowSettings()
{
Left = 123,
Top = 456,
Height = 321,
Width = 654,
Status = WindowStatus.Maximized
}
});
settings.GroupStyleItemsList.Add(new GroupStyleItem
{
Name = "TestGroup",
HexColorString = "000000"
});
settings.DynamoPlayerFolderGroups.Add(new DynamoPlayerFolderGroup()
{
EntryPoint = "GenerativeDesign",
Folders = new List<DynamoPlayerFolder>()
{
new DynamoPlayerFolder()
{
Path = @"C:\MyGenerativeDesignFolder",
DisplayName = "My Generative Design Folder",
Id = "41B5B0F7-1B21-42A8-A938-E2C34521EF61",
IsRemovable = true,
Order = -1,
}
}
});
settings.EnableDynamoPlayerRenamedWatchAsOutput = true;
settings.Locale = "zh-CN";
// Save
settings.Save(tempPath);
settings = PreferenceSettings.Load(tempPath);
// Assert deserialized values are same as last changed
Assert.AreEqual(settings.GetIsBackgroundPreviewActive("MyBackgroundPreview"), false);
Assert.AreEqual(settings.ShowCodeBlockLineNumber, false);
Assert.AreEqual(settings.ShowTabsAndSpacesInScriptEditor, true);
Assert.AreEqual(settings.DefaultPythonEngine, "CP3");
Assert.AreEqual(settings.MaxNumRecentFiles, 24);
Assert.AreEqual(settings.BackupInterval, 120000);
Assert.AreEqual(settings.UseHardwareAcceleration, false);
Assert.AreEqual(settings.EnableNodeAutoComplete, false);
Assert.AreEqual(settings.IsAutoSyncDocumentBrowser, false);
Assert.AreEqual(settings.EnableNotificationCenter, false);
Assert.AreEqual(settings.ViewExtensionSettings.Count, 1);
var extensionSettings = settings.ViewExtensionSettings[0];
Assert.AreEqual(settings.DefaultRunType, RunType.Manual);
Assert.AreEqual(extensionSettings.Name, "MyExtension");
Assert.AreEqual(extensionSettings.UniqueId, "1234");
Assert.AreEqual(extensionSettings.DisplayMode, ViewExtensionDisplayMode.FloatingWindow);
Assert.IsNotNull(extensionSettings.WindowSettings);
var windowSettings = extensionSettings.WindowSettings;
Assert.AreEqual(windowSettings.Left, 123);
Assert.AreEqual(windowSettings.Top, 456);
Assert.AreEqual(windowSettings.Height, 321);
Assert.AreEqual(windowSettings.Width, 654);
Assert.AreEqual(windowSettings.Status, WindowStatus.Maximized);
// Load function will only deserialize the customized style
Assert.AreEqual(settings.GroupStyleItemsList.Count, 1);
var styleItemsList = settings.GroupStyleItemsList[0];
Assert.AreEqual(styleItemsList.Name, "TestGroup");
Assert.AreEqual(styleItemsList.HexColorString, "000000");
Assert.AreEqual(settings.DynamoPlayerFolderGroups.Count, 1);
Assert.AreEqual(settings.DynamoPlayerFolderGroups[0].Folders.Count, 1);
Assert.AreEqual(settings.EnableDynamoPlayerRenamedWatchAsOutput, true);
Assert.AreEqual(settings.Locale, "zh-CN");
}
[Test]
[Category("UnitTests")]
public void TestMigrateStdLibTokenToBuiltInToken()
{
string settingDirectory = Path.Combine(TestDirectory, "settings");
string settingsFilePath = Path.Combine(settingDirectory, "DynamoSettings-stdlibtoken.xml");
Assert.IsTrue(File.ReadAllText(settingsFilePath).Contains(DynamoModel.StandardLibraryToken));
// Assert files required for test exist
Assert.IsTrue(File.Exists(settingsFilePath));
var settings = PreferenceSettings.Load(settingsFilePath);
var token = settings.CustomPackageFolders[1];
Assert.AreEqual(DynamoModel.BuiltInPackagesToken, token);
}
[Test]
[Category("UnitTests")]
public void TestSerializationDisableTrustWarnings()
{
//create new prefs
var prefs = new PreferenceSettings();
//assert default.
Assert.IsFalse(prefs.DisableTrustWarnings);
prefs.SetTrustWarningsDisabled(true);
Assert.True(prefs.DisableTrustWarnings);
//save
var tempPath = GetNewFileNameOnTempPath(".xml");
prefs.Save(tempPath);
//load
var settingsLoaded = PreferenceSettings.Load(tempPath);
Assert.IsTrue(settingsLoaded.DisableTrustWarnings);
}
[Test]
[Category("UnitTests")]
public void TestSerializationTrustedLocations()
{
//create new prefs
var prefs = new PreferenceSettings();
//assert default.
Assert.AreEqual(0, prefs.TrustedLocations.Count);
prefs.SetTrustedLocations(new List<string>() { Path.GetTempPath() });
Assert.AreEqual(1, prefs.TrustedLocations.Count);
//save
var tempPath = GetNewFileNameOnTempPath(".xml");
prefs.Save(tempPath);
//load
var settingsLoaded = PreferenceSettings.Load(tempPath);
Assert.AreEqual(1, settingsLoaded.TrustedLocations.Count);
Assert.IsTrue(settingsLoaded.IsTrustedLocation(Path.GetTempPath()));
}
/// <summary>
/// Struct to support the comparison between two PreferenceSettings instances
/// </summary>
struct PreferencesComparison
{
public List<string> Properties { get; set; }
public List<String> SamePropertyValues { get; set; }
public List<String> DifferentPropertyValues { get; set; }
}
/// <summary>
/// Indicates if the Property has at least one custom attribute that is going to be excluded from the mapping
/// </summary>
/// <param name="property"></param>
/// <returns></returns>
bool PropertyHasExcludedAttributes(PropertyInfo property)
{
return property.GetCustomAttributes(typeof(System.ObsoleteAttribute), true).Length > 0 ||
property.GetCustomAttributes(typeof(System.Xml.Serialization.XmlIgnoreAttribute), true).Length > 0;
}
/// <summary>
/// Checks if a property has a static mapped field
/// </summary>
/// <param name="preferenceInstance"></param>
/// <param name="property"></param>
/// <returns></returns>
bool PropertyHasStaticField(PreferenceSettings preferenceInstance, PropertyInfo property)
{
return preferenceInstance.StaticFields().ConvertAll(fieldName => fieldName.ToUpper()).Contains(property.Name.ToUpper());
}
/// <summary>
/// Compare the property values of two PreferenceSettings instances
/// </summary>
/// <param name="defaultSettings"></param>
/// <param name="newGeneralSettings"></param>
/// <returns>3 List of Properties, the properties that have been evaluated, the properties that have the same values and the properties that have different values</returns>
PreferencesComparison comparePrefenceSettings(PreferenceSettings defaultSettings, PreferenceSettings newGeneralSettings)
{
var result = new PreferencesComparison();
var propertiesWithSameValue = new List<string>();
var propertiesWithDifferentValue = new List<string>();
var evaluatedProperties = new List<string>();
var destinationProperties = defaultSettings.GetType().GetProperties();
foreach (var destinationPi in destinationProperties)
{
var sourcePi = newGeneralSettings.GetType().GetProperty(destinationPi.Name);
if (sourcePi.Name == "DynamoPlayerFolderGroups")
{
// Do nothing for now
}
if (!PropertyHasExcludedAttributes(destinationPi) && !PropertyHasStaticField(defaultSettings, destinationPi))
{
evaluatedProperties.Add(destinationPi.Name);
var newValue = sourcePi.GetValue(newGeneralSettings, null);
var oldValue = destinationPi.GetValue(defaultSettings, null);
if (destinationPi.PropertyType == typeof(List<string>))
{
var newList = (List<string>)sourcePi.GetValue(newGeneralSettings, null);
var oldList = (List<string>)destinationPi.GetValue(defaultSettings, null);
if (newList.Except(oldList).ToList().Count == 0)
{
propertiesWithSameValue.Add(destinationPi.Name);
}
else
{
propertiesWithDifferentValue.Add(destinationPi.Name);
}
}
else if (destinationPi.PropertyType == typeof(List<GroupStyleItem>))
{
if (((List<GroupStyleItem>)sourcePi.GetValue(newGeneralSettings, null)).Count ==
((List<GroupStyleItem>)destinationPi.GetValue(defaultSettings, null)).Count)
{
propertiesWithSameValue.Add(destinationPi.Name);
}
else
{
propertiesWithDifferentValue.Add(destinationPi.Name);
}
}
else if (destinationPi.PropertyType == typeof(List<ViewExtensionSettings>))
{
if (((List<ViewExtensionSettings>)sourcePi.GetValue(newGeneralSettings, null)).Count ==
((List<ViewExtensionSettings>)destinationPi.GetValue(defaultSettings, null)).Count)
{
propertiesWithSameValue.Add(destinationPi.Name);
}
else
{
propertiesWithDifferentValue.Add(destinationPi.Name);
}
}
else if (destinationPi.PropertyType == typeof(List<BackgroundPreviewActiveState>))
{
if (((List<BackgroundPreviewActiveState>)sourcePi.GetValue(newGeneralSettings, null)).Count ==
((List<BackgroundPreviewActiveState>)destinationPi.GetValue(defaultSettings, null)).Count)
{
propertiesWithSameValue.Add(destinationPi.Name);
}
else
{
propertiesWithDifferentValue.Add(destinationPi.Name);
}
}
else if (destinationPi.PropertyType == typeof(List<DynamoPlayerFolderGroup>))
{
if (((List<DynamoPlayerFolderGroup>)sourcePi.GetValue(newGeneralSettings, null)).Count ==
((List<DynamoPlayerFolderGroup>)destinationPi.GetValue(defaultSettings, null)).Count)
{
propertiesWithSameValue.Add(destinationPi.Name);
}
else
{
propertiesWithDifferentValue.Add(destinationPi.Name);
}
}
else
{
if (newValue?.ToString() == oldValue?.ToString())
{
propertiesWithSameValue.Add(destinationPi.Name);
}
else
{
propertiesWithDifferentValue.Add(destinationPi.Name);
}
}
}
}
result.SamePropertyValues = propertiesWithSameValue;
result.DifferentPropertyValues = propertiesWithDifferentValue;
result.Properties = evaluatedProperties;
return result;
}
[Test]
[Category("UnitTests")]
public void TestImportCopySettings()
{
string settingDirectory = Path.Combine(TestDirectory, "settings");
string newSettingslFilePath = Path.Combine(settingDirectory, "DynamoSettings-NewSettings.xml");
var defaultSettings = new PreferenceSettings();
var newSettings = PreferenceSettings.Load(newSettingslFilePath);
// validation
Assert.IsTrue(newSettings.IsCreatedFromValidFile, "The new settings file is invalid");
bool newSettingsExist = File.Exists(newSettingslFilePath);
var checkDifference = comparePrefenceSettings(defaultSettings, newSettings);
int diffProps = checkDifference.DifferentPropertyValues.Count;
int totProps = checkDifference.Properties.Count;
string firstPropertyWithSameOrNewValue = checkDifference.Properties.Except(checkDifference.DifferentPropertyValues).ToList().FirstOrDefault();
string defSettNumberFormat = defaultSettings.NumberFormat;
string newSettNumberFormat = newSettings.NumberFormat;
string failMessage = $"The file {newSettingslFilePath} exist: {newSettingsExist.ToString()} " +
$"| DiffProps: {diffProps.ToString()} " +
$"| TotProps: {totProps.ToString()} | Default Sett NumberFormat: {defSettNumberFormat} " +
$"| New Sett NumberFormat: {newSettNumberFormat} " +
$"| First Property with the same value {firstPropertyWithSameOrNewValue}";
// checking if the new Setting are completely different from the Default
Assert.IsTrue(checkDifference.DifferentPropertyValues.Count == checkDifference.Properties.Count, failMessage);
// GroupStyle - Assigning Default styles
defaultSettings.GroupStyleItemsList = GroupStyleItem.DefaultGroupStyleItems.AddRange(defaultSettings.GroupStyleItemsList.Where(style => style.IsDefault != true)).ToList();
newSettings.CopyProperties(defaultSettings);
// Checking if the new settings has at least a Custom Style
Assert.IsTrue(defaultSettings.GroupStyleItemsList.Where(style => style.IsDefault == false).Count() > 0);
// Explicit copy
defaultSettings.SetTrustWarningsDisabled(newSettings.DisableTrustWarnings);
defaultSettings.SetTrustedLocations(newSettings.TrustedLocations);
// checking if the default Setting instance has the same property values of the new one
var checkEquality = comparePrefenceSettings(defaultSettings, newSettings);
Assert.IsTrue(checkEquality.SamePropertyValues.Count == checkEquality.Properties.Count);
}
[Test]
[Category("UnitTests")]
public void WhenSettingsAreNewThenMcpServerOnStartupDefaultsToFalse()
{
// The MCP server must stay off unless the user opts in (DYN-9355).
var settings = new PreferenceSettings();
Assert.IsFalse(settings.EnableMcpServerOnStartup);
}
[Test]
[Category("UnitTests")]
public void WhenMcpServerOnStartupIsEnabledThenItPersistsAcrossSaveAndLoad()
{
// Use a unique file under the per-test TempFolder, which UnitTestBase cleans up on teardown.
string tempPath = GetNewFileNameOnTempPath("xml");
var settings = new PreferenceSettings();
settings.EnableMcpServerOnStartup = true;
settings.Save(tempPath);
var loadedSettings = PreferenceSettings.Load(tempPath);
Assert.IsTrue(loadedSettings.EnableMcpServerOnStartup);
}
[Test]
[Category("UnitTests")]
public void TestTaintedFile()
{
string settingDirectory = Path.Combine(TestDirectory, "settings");
string newSettingslFilePath = Path.Combine(settingDirectory, "DynamoSettings-TaintedSettings.xml");
var newSettings = PreferenceSettings.Load(newSettingslFilePath);
Assert.IsFalse(newSettings.IsCreatedFromValidFile, "The new settings file is valid");
}
[Test]
[Category("UnitTests")]
public void TestAskForTrustedLocation()
{
//Settings
bool isOpenedFile = true;
bool isHomeSpace = true;
bool isShowStartPage = false;
bool isFileInTrustedLocation = false;
bool isDisableTrustWarnings = false;
// getting result
PreferenceSettings.AskForTrustedLocationResult result = PreferenceSettings.AskForTrustedLocation(
isOpenedFile,
isFileInTrustedLocation,
isHomeSpace,
isShowStartPage,
isDisableTrustWarnings);
// checking the result
Assert.IsTrue(result == PreferenceSettings.AskForTrustedLocationResult.Ask, $"Conditions info: is opened file : {isOpenedFile} | is file in trusted location : {isFileInTrustedLocation} | is home space : {isHomeSpace} | is show Start page : {isShowStartPage} | is disable trust warnings : {isDisableTrustWarnings}");
}
[Test]
[Category("UnitTests")]
public void TestSanitizeValues()
{
string settingDirectory = Path.Combine(TestDirectory, "settings");
string settingslFilePath = Path.Combine(settingDirectory, "DynamoSettings_Tainted_Values.xml");
var settings = PreferenceSettings.Load(settingslFilePath);
settings.SanitizeValues();
bool allTheGroupStylesHaveAValidFontSize = true;
foreach (var groupStyle in settings.GroupStyleItemsList)
{
if (!settings.PredefinedGroupStyleFontSizes.Contains(groupStyle.FontSize))
{
allTheGroupStylesHaveAValidFontSize = false;
break;
}
}
Assert.IsTrue(allTheGroupStylesHaveAValidFontSize, $"All the GroupStyles have a valid Font size : {allTheGroupStylesHaveAValidFontSize}");
}
[Test]
[Category("UnitTests")]
public void TestSerializingHomePageSettings()
{
string tempPath = System.IO.Path.GetTempPath();
tempPath = Path.Combine(tempPath, "homePagePreference.xml");
PreferenceSettings settings = new PreferenceSettings();
// Assert defaults
Assert.IsEmpty(settings.HomePageSettings);
settings.HomePageSettings = new List<string> { { String.Concat("greeting", "Hello World") } };
// Save
settings.Save(tempPath);
settings = PreferenceSettings.Load(tempPath);
Assert.IsTrue(settings.HomePageSettings.Contains(String.Concat("greeting", "Hello World")));
}
[Test]
[Category("UnitTests")]
public void TestPathManagerSamplesDirectoryRespectsLocalePreference()
{
// Arrange
var pathManagerParams = new PathManagerParams
{
CorePath = Path.GetDirectoryName(typeof(PathManager).Assembly.Location)
};
var pathManager = new PathManager(pathManagerParams);
var preferences = new PreferenceSettings { Locale = "es-ES" };
pathManager.Preferences = preferences;
// Act
var samplesPath = pathManager.SamplesDirectory;
// Assert - samples path should contain the locale
Assert.That(samplesPath, Is.Not.Null);
var expectedPathSegment = Path.Combine("samples", "es-ES");
Assert.That(samplesPath, Does.EndWith(expectedPathSegment));
}
}
}