@@ -25,6 +25,9 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Web.BackOffice.Controllers
25
25
[ TestFixture ]
26
26
public class ContentControllerTests : UmbracoTestServerTestBase
27
27
{
28
+ private const string UsIso = "en-US" ;
29
+ private const string DkIso = "da-DK" ;
30
+
28
31
/// <summary>
29
32
/// Returns 404 if the content wasn't found based on the ID specified
30
33
/// </summary>
@@ -35,7 +38,7 @@ public async Task PostSave_Validate_Existing_Content()
35
38
36
39
// Add another language
37
40
localizationService . Save ( new LanguageBuilder ( )
38
- . WithCultureInfo ( "da-DK" )
41
+ . WithCultureInfo ( DkIso )
39
42
. WithIsDefault ( false )
40
43
. Build ( ) ) ;
41
44
@@ -93,7 +96,7 @@ public async Task PostSave_Validate_At_Least_One_Variant_Flagged_For_Saving()
93
96
94
97
// Add another language
95
98
localizationService . Save ( new LanguageBuilder ( )
96
- . WithCultureInfo ( "da-DK" )
99
+ . WithCultureInfo ( DkIso )
97
100
. WithIsDefault ( false )
98
101
. Build ( ) ) ;
99
102
@@ -162,7 +165,7 @@ public async Task PostSave_Validate_Properties_Exist()
162
165
163
166
// Add another language
164
167
localizationService . Save ( new LanguageBuilder ( )
165
- . WithCultureInfo ( "da-DK" )
168
+ . WithCultureInfo ( DkIso )
166
169
. WithIsDefault ( false )
167
170
. Build ( ) ) ;
168
171
@@ -227,7 +230,7 @@ public async Task PostSave_Simple_Invariant()
227
230
228
231
// Add another language
229
232
localizationService . Save ( new LanguageBuilder ( )
230
- . WithCultureInfo ( "da-DK" )
233
+ . WithCultureInfo ( DkIso )
231
234
. WithIsDefault ( false )
232
235
. Build ( ) ) ;
233
236
@@ -288,7 +291,7 @@ public async Task PostSave_Validate_Empty_Name()
288
291
289
292
// Add another language
290
293
localizationService . Save ( new LanguageBuilder ( )
291
- . WithCultureInfo ( "da-DK" )
294
+ . WithCultureInfo ( DkIso )
292
295
. WithIsDefault ( false )
293
296
. Build ( ) ) ;
294
297
@@ -352,7 +355,7 @@ public async Task PostSave_Validate_Variants_Empty_Name()
352
355
353
356
// Add another language
354
357
localizationService . Save ( new LanguageBuilder ( )
355
- . WithCultureInfo ( "da-DK" )
358
+ . WithCultureInfo ( DkIso )
356
359
. WithIsDefault ( false )
357
360
. Build ( ) ) ;
358
361
@@ -376,8 +379,8 @@ public async Task PostSave_Validate_Variants_Empty_Name()
376
379
377
380
Content content = new ContentBuilder ( )
378
381
. WithId ( 0 )
379
- . WithCultureName ( "en-US" , "English" )
380
- . WithCultureName ( "da-DK" , "Danish" )
382
+ . WithCultureName ( UsIso , "English" )
383
+ . WithCultureName ( DkIso , "Danish" )
381
384
. WithContentType ( contentType )
382
385
. AddPropertyData ( )
383
386
. WithKeyValue ( "title" , "Cool invariant title" )
@@ -414,7 +417,7 @@ public async Task PostSave_Validates_Domains_Exist()
414
417
{
415
418
ILocalizationService localizationService = GetRequiredService < ILocalizationService > ( ) ;
416
419
localizationService . Save ( new LanguageBuilder ( )
417
- . WithCultureInfo ( "da-DK" )
420
+ . WithCultureInfo ( DkIso )
418
421
. WithIsDefault ( false )
419
422
. Build ( ) ) ;
420
423
@@ -425,8 +428,8 @@ public async Task PostSave_Validates_Domains_Exist()
425
428
Content content = new ContentBuilder ( )
426
429
. WithId ( 1 )
427
430
. WithContentType ( contentType )
428
- . WithCultureName ( "en-US" , "Root" )
429
- . WithCultureName ( "da-DK" , "Rod" )
431
+ . WithCultureName ( UsIso , "Root" )
432
+ . WithCultureName ( DkIso , "Rod" )
430
433
. Build ( ) ;
431
434
432
435
ContentItemSave model = new ContentItemSaveBuilder ( )
@@ -459,12 +462,9 @@ public async Task PostSave_Validates_Domains_Exist()
459
462
[ Test ]
460
463
public async Task PostSave_Validates_All_Cultures_Has_Domains ( )
461
464
{
462
- var enString = "en-US" ;
463
- var dkString = "da-DK" ;
464
-
465
465
ILocalizationService localizationService = GetRequiredService < ILocalizationService > ( ) ;
466
466
localizationService . Save ( new LanguageBuilder ( )
467
- . WithCultureInfo ( dkString )
467
+ . WithCultureInfo ( DkIso )
468
468
. WithIsDefault ( false )
469
469
. Build ( ) ) ;
470
470
@@ -475,8 +475,8 @@ public async Task PostSave_Validates_All_Cultures_Has_Domains()
475
475
Content content = new ContentBuilder ( )
476
476
. WithoutIdentity ( )
477
477
. WithContentType ( contentType )
478
- . WithCultureName ( enString , "Root" )
479
- . WithCultureName ( dkString , "Rod" )
478
+ . WithCultureName ( UsIso , "Root" )
479
+ . WithCultureName ( DkIso , "Rod" )
480
480
. Build ( ) ;
481
481
482
482
IContentService contentService = GetRequiredService < IContentService > ( ) ;
@@ -487,7 +487,7 @@ public async Task PostSave_Validates_All_Cultures_Has_Domains()
487
487
. WithAction ( ContentSaveAction . Publish )
488
488
. Build ( ) ;
489
489
490
- ILanguage dkLanguage = localizationService . GetLanguageByIsoCode ( dkString ) ;
490
+ ILanguage dkLanguage = localizationService . GetLanguageByIsoCode ( DkIso ) ;
491
491
IDomainService domainService = GetRequiredService < IDomainService > ( ) ;
492
492
var dkDomain = new UmbracoDomain ( "/" )
493
493
{
@@ -509,7 +509,7 @@ public async Task PostSave_Validates_All_Cultures_Has_Domains()
509
509
510
510
511
511
ILocalizedTextService localizedTextService = GetRequiredService < ILocalizedTextService > ( ) ;
512
- var expectedMessage = localizedTextService . Localize ( "speechBubbles" , "publishWithMissingDomain" , new [ ] { "en-US" } ) ;
512
+ var expectedMessage = localizedTextService . Localize ( "speechBubbles" , "publishWithMissingDomain" , new [ ] { UsIso } ) ;
513
513
514
514
Assert . Multiple ( ( ) =>
515
515
{
@@ -522,12 +522,9 @@ public async Task PostSave_Validates_All_Cultures_Has_Domains()
522
522
[ Test ]
523
523
public async Task PostSave_Checks_Ancestors_For_Domains ( )
524
524
{
525
- var enString = "en-US" ;
526
- var dkString = "da-DK" ;
527
-
528
525
ILocalizationService localizationService = GetRequiredService < ILocalizationService > ( ) ;
529
526
localizationService . Save ( new LanguageBuilder ( )
530
- . WithCultureInfo ( dkString )
527
+ . WithCultureInfo ( DkIso )
531
528
. WithIsDefault ( false )
532
529
. Build ( ) ) ;
533
530
@@ -538,8 +535,8 @@ public async Task PostSave_Checks_Ancestors_For_Domains()
538
535
Content rootNode = new ContentBuilder ( )
539
536
. WithoutIdentity ( )
540
537
. WithContentType ( contentType )
541
- . WithCultureName ( enString , "Root" )
542
- . WithCultureName ( dkString , "Rod" )
538
+ . WithCultureName ( UsIso , "Root" )
539
+ . WithCultureName ( DkIso , "Rod" )
543
540
. Build ( ) ;
544
541
545
542
IContentService contentService = GetRequiredService < IContentService > ( ) ;
@@ -549,8 +546,8 @@ public async Task PostSave_Checks_Ancestors_For_Domains()
549
546
. WithoutIdentity ( )
550
547
. WithParent ( rootNode )
551
548
. WithContentType ( contentType )
552
- . WithCultureName ( dkString , "Barn" )
553
- . WithCultureName ( enString , "Child" )
549
+ . WithCultureName ( DkIso , "Barn" )
550
+ . WithCultureName ( UsIso , "Child" )
554
551
. Build ( ) ;
555
552
556
553
contentService . SaveAndPublish ( childNode ) ;
@@ -559,14 +556,14 @@ public async Task PostSave_Checks_Ancestors_For_Domains()
559
556
. WithoutIdentity ( )
560
557
. WithParent ( childNode )
561
558
. WithContentType ( contentType )
562
- . WithCultureName ( dkString , "BarneBarn" )
563
- . WithCultureName ( enString , "GrandChild" )
559
+ . WithCultureName ( DkIso , "BarneBarn" )
560
+ . WithCultureName ( UsIso , "GrandChild" )
564
561
. Build ( ) ;
565
562
566
563
contentService . Save ( grandChild ) ;
567
564
568
- ILanguage dkLanguage = localizationService . GetLanguageByIsoCode ( dkString ) ;
569
- ILanguage usLanguage = localizationService . GetLanguageByIsoCode ( enString ) ;
565
+ ILanguage dkLanguage = localizationService . GetLanguageByIsoCode ( DkIso ) ;
566
+ ILanguage usLanguage = localizationService . GetLanguageByIsoCode ( UsIso ) ;
570
567
IDomainService domainService = GetRequiredService < IDomainService > ( ) ;
571
568
var dkDomain = new UmbracoDomain ( "/" )
572
569
{
0 commit comments