@@ -1348,6 +1348,107 @@ public void Cannot_Publish_Content_Awaiting_Release()
1348
1348
Assert . AreEqual ( PublishResultType . FailedPublishAwaitingRelease , published . Result ) ;
1349
1349
}
1350
1350
1351
+ [ Test ]
1352
+ public void Failed_Publish_Should_Not_Update_Edited_State_When_Edited_True ( )
1353
+ {
1354
+ // Arrange
1355
+ IContentService contentService = GetRequiredService < IContentService > ( ) ;
1356
+ IContentTypeService contentTypeService = GetRequiredService < IContentTypeService > ( ) ;
1357
+
1358
+ IContentType contentType = new ContentTypeBuilder ( )
1359
+ . WithId ( 0 )
1360
+ . AddPropertyType ( )
1361
+ . WithAlias ( "header" )
1362
+ . WithValueStorageType ( ValueStorageType . Integer )
1363
+ . WithPropertyEditorAlias ( Constants . PropertyEditors . Aliases . TextBox )
1364
+ . WithName ( "header" )
1365
+ . Done ( )
1366
+ . WithContentVariation ( ContentVariation . Nothing )
1367
+ . Build ( ) ;
1368
+
1369
+ contentTypeService . Save ( contentType ) ;
1370
+
1371
+ Content content = new ContentBuilder ( )
1372
+ . WithId ( 0 )
1373
+ . WithName ( "Home" )
1374
+ . WithContentType ( contentType )
1375
+ . AddPropertyData ( )
1376
+ . WithKeyValue ( "header" , "Cool header" )
1377
+ . Done ( )
1378
+ . Build ( ) ;
1379
+
1380
+ contentService . SaveAndPublish ( content ) ;
1381
+
1382
+ content . Properties [ 0 ] . SetValue ( "Foo" , culture : string . Empty ) ;
1383
+ content . ContentSchedule . Add ( DateTime . Now . AddHours ( 2 ) , null ) ;
1384
+ contentService . Save ( content ) ;
1385
+
1386
+ // Act
1387
+ var result = contentService . SaveAndPublish ( content , userId : Constants . Security . SuperUserId ) ;
1388
+
1389
+ // Assert
1390
+ Assert . Multiple ( ( ) =>
1391
+ {
1392
+ Assert . IsFalse ( result . Success ) ;
1393
+ Assert . IsTrue ( result . Content . Published ) ;
1394
+ Assert . AreEqual ( PublishResultType . FailedPublishAwaitingRelease , result . Result ) ;
1395
+
1396
+ // We changed property data
1397
+ Assert . IsTrue ( result . Content . Edited , "result.Content.Edited" ) ;
1398
+ } ) ;
1399
+ }
1400
+
1401
+ // V9 - Tests.Integration
1402
+ [ Test ]
1403
+ public void Failed_Publish_Should_Not_Update_Edited_State_When_Edited_False ( )
1404
+ {
1405
+ // Arrange
1406
+ IContentService contentService = GetRequiredService < IContentService > ( ) ;
1407
+ IContentTypeService contentTypeService = GetRequiredService < IContentTypeService > ( ) ;
1408
+
1409
+ IContentType contentType = new ContentTypeBuilder ( )
1410
+ . WithId ( 0 )
1411
+ . AddPropertyType ( )
1412
+ . WithAlias ( "header" )
1413
+ . WithValueStorageType ( ValueStorageType . Integer )
1414
+ . WithPropertyEditorAlias ( Constants . PropertyEditors . Aliases . TextBox )
1415
+ . WithName ( "header" )
1416
+ . Done ( )
1417
+ . WithContentVariation ( ContentVariation . Nothing )
1418
+ . Build ( ) ;
1419
+
1420
+ contentTypeService . Save ( contentType ) ;
1421
+
1422
+ Content content = new ContentBuilder ( )
1423
+ . WithId ( 0 )
1424
+ . WithName ( "Home" )
1425
+ . WithContentType ( contentType )
1426
+ . AddPropertyData ( )
1427
+ . WithKeyValue ( "header" , "Cool header" )
1428
+ . Done ( )
1429
+ . Build ( ) ;
1430
+
1431
+ contentService . SaveAndPublish ( content ) ;
1432
+
1433
+ content . ContentSchedule . Add ( DateTime . Now . AddHours ( 2 ) , null ) ;
1434
+ contentService . Save ( content ) ;
1435
+
1436
+ // Act
1437
+ var result = contentService . SaveAndPublish ( content , userId : Constants . Security . SuperUserId ) ;
1438
+
1439
+ // Assert
1440
+ Assert . Multiple ( ( ) =>
1441
+ {
1442
+ Assert . IsFalse ( result . Success ) ;
1443
+ Assert . IsTrue ( result . Content . Published ) ;
1444
+ Assert . AreEqual ( PublishResultType . FailedPublishAwaitingRelease , result . Result ) ;
1445
+
1446
+ // We didn't change any property data
1447
+ Assert . IsFalse ( result . Content . Edited , "result.Content.Edited" ) ;
1448
+ } ) ;
1449
+ }
1450
+
1451
+
1351
1452
[ Test ]
1352
1453
public void Cannot_Publish_Culture_Awaiting_Release ( )
1353
1454
{
@@ -2151,7 +2252,7 @@ public void Can_Rollback_Version_On_Content()
2151
2252
ContentService . Save ( rollback2 ) ;
2152
2253
2153
2254
Assert . IsTrue ( rollback2 . Published ) ;
2154
- Assert . IsFalse ( rollback2 . Edited ) ; // all changes cleared!
2255
+ Assert . IsTrue ( rollback2 . Edited ) ; // till edited, change of behaviour
2155
2256
2156
2257
Assert . AreEqual ( "Jane Doe" , rollback2 . GetValue < string > ( "author" ) ) ;
2157
2258
Assert . AreEqual ( "Text Page 2 ReReUpdated" , rollback2 . Name ) ;
@@ -2170,7 +2271,7 @@ public void Can_Rollback_Version_On_Content()
2170
2271
content . CopyFrom ( rollto ) ;
2171
2272
content . Name = rollto . PublishName ; // must do it explicitely AND must pick the publish one!
2172
2273
ContentService . Save ( content ) ;
2173
- Assert . IsFalse ( content . Edited ) ;
2274
+ Assert . IsTrue ( content . Edited ) ; //Still edited, change of behaviour
2174
2275
Assert . AreEqual ( "Text Page 2 ReReUpdated" , content . Name ) ;
2175
2276
Assert . AreEqual ( "Jane Doe" , content . GetValue ( "author" ) ) ;
2176
2277
}
0 commit comments