fix and annotate some tests

This commit is contained in:
Stephan
2017-06-28 12:46:40 +02:00
parent 3d65afabbf
commit 8fbb459233
2 changed files with 14 additions and 12 deletions

View File

@@ -1403,6 +1403,7 @@ namespace Umbraco.Tests.Services
}));
Assert.IsTrue(ServiceContext.PublicAccessService.AddRule(content1, "test2", "test2").Success);
// how is that one even working since "test" is more than 1 char?
Assert.IsNotNull(ServiceContext.NotificationService.CreateNotification(ServiceContext.UserService.GetUserById(0), content1, "test"));
ServiceContext.ContentService.AssignContentPermission(content1, 'A', new[] {0});
@@ -1411,7 +1412,7 @@ namespace Umbraco.Tests.Services
{
RootContentId = content1.Id
}).Success);
// Act
ServiceContext.ContentService.EmptyRecycleBin();
var contents = ServiceContext.ContentService.GetContentInRecycleBin();
@@ -1814,7 +1815,7 @@ namespace Umbraco.Tests.Services
var c1 = MockedContent.CreateSimpleContent(contentType);
ServiceContext.ContentService.Save(c1);
}
long total;
var entities = service.GetPagedChildren(-1, 0, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(6));
@@ -1834,7 +1835,7 @@ namespace Umbraco.Tests.Services
var contentType = MockedContentTypes.CreateSimpleContentType();
ServiceContext.ContentTypeService.Save(contentType);
// only add 9 as we also add a content with children
// only add 9 as we also add a content with children
for (int i = 0; i < 9; i++)
{
var c1 = MockedContent.CreateSimpleContent(contentType);

View File

@@ -222,7 +222,7 @@ namespace Umbraco.Tests.Services
var root = MockedContent.CreateSimpleContent(contentType1, "Root", -1);
ServiceContext.ContentService.Save(root);
ServiceContext.ContentService.Publish(root);
var level1 = MockedContent.CreateSimpleContent(contentType2, "L1", root.Id);
ServiceContext.ContentService.Save(level1);
ServiceContext.ContentService.Publish(level1);
@@ -520,7 +520,7 @@ namespace Umbraco.Tests.Services
var deletedContent = cs.GetById(content.Id);
var deletedChildContentType = cts.GetContentType(childContentType.Id);
var deletedContentType = cts.GetContentType(contentType.Id);
Assert.IsNull(deletedChildContentType);
Assert.IsNull(deletedContent);
Assert.IsNull(deletedContentType);
@@ -980,7 +980,7 @@ namespace Umbraco.Tests.Services
{
// Arrange
var contentType = MockedContentTypes.CreateSimpleContentType("contentType", string.Empty);
// Act & Assert
Assert.Throws<ArgumentException>(() => ServiceContext.ContentTypeService.Save(contentType));
}
@@ -1542,7 +1542,8 @@ namespace Umbraco.Tests.Services
SortOrder = 1,
DataTypeDefinitionId = -88
};
var authorAdded = basePage.AddPropertyType(authorPropertyType, "Content");
Assert.IsTrue(basePage.AddPropertyType(authorPropertyType, "Content"));
var titlePropertyType = new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext, "title")
{
Name = "Title",
@@ -1551,20 +1552,20 @@ namespace Umbraco.Tests.Services
SortOrder = 1,
DataTypeDefinitionId = -88
};
var titleAdded = basePage.AddPropertyType(authorPropertyType, "Meta");
Assert.IsTrue(basePage.AddPropertyType(titlePropertyType, "Meta"));
service.Save(basePage);
basePage = service.GetContentType(basePage.Id);
var totalPt = basePage.PropertyTypes.Count();
var count = basePage.PropertyTypes.Count();
Assert.AreEqual(2, count);
basePage.RemovePropertyGroup("Content");
service.Save(basePage);
service.Save(basePage);
basePage = service.GetContentType(basePage.Id);
Assert.AreEqual(totalPt, basePage.PropertyTypes.Count());
Assert.AreEqual(count, basePage.PropertyTypes.Count());
}
[Test]