Files
Umbraco-CMS/tests/Umbraco.Tests/PublishedContent/RootNodeTests.cs
Paul Johnson 00133e880d Move test projects from src/ to tests/ (#11357)
* Update gitignore

* Move csproj

* Update project references

* Update solutions

* Update build scripts

* Tests used to share editorconfig with projects in src

* Fix broken tests.

* Stop copying around .editorconfig

merged root one with linting

* csharp_style_expression_bodied -> suggestion

* Move StyleCop rulesets to matching directories and update shared build properties

* Remove legacy build files, update NuGet.cofig and solution files

* Restore myget source

* Clean up .gitignore

* Update .gitignore

* Move new test classes to tests after merge

* Gitignore + nuget config

* Move new test

Co-authored-by: Ronald Barendse <ronald@barend.se>
2021-10-18 08:14:04 +01:00

32 lines
830 B
C#

using System.Linq;
using NUnit.Framework;
using Umbraco.Web;
namespace Umbraco.Tests.PublishedContent
{
[TestFixture]
public class RootNodeTests : PublishedContentTestBase
{
[Test]
public void PublishedContentHasNoRootNode()
{
var ctx = GetUmbracoContext("/test");
// there is no content node with ID -1
var content = ctx.Content.GetById(-1);
Assert.IsNull(content);
// content at root has null parent
content = ctx.Content.GetById(1046);
Assert.IsNotNull(content);
Assert.AreEqual(1, content.Level);
Assert.IsNull(content.Parent);
// non-existing content is null
content = ctx.Content.GetById(666);
Assert.IsNull(content);
}
}
}