Files
Umbraco-CMS/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Models/DocumentEntityTests.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

47 lines
1.3 KiB
C#

// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.Diagnostics;
using Newtonsoft.Json;
using NUnit.Framework;
using Umbraco.Cms.Core.Models.Entities;
using Umbraco.Cms.Tests.Common.Builders;
using Umbraco.Cms.Tests.Common.Builders.Extensions;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Models
{
[TestFixture]
public class DocumentEntityTests
{
private DocumentEntitySlimBuilder _builder;
[SetUp]
public void SetUp() => _builder = new DocumentEntitySlimBuilder();
[Test]
public void Can_Serialize_Without_Error()
{
DocumentEntitySlim item = _builder
.WithId(3)
.WithCreatorId(4)
.WithName("Test")
.WithParentId(5)
.WithSortOrder(6)
.WithLevel(7)
.WithContentTypeAlias("test1")
.WithContentTypeIcon("icon")
.WithContentTypeThumbnail("thumb")
.WithHasChildren(true)
.WithPublished(true)
.AddAdditionalData()
.WithKeyValue("test1", 3)
.WithKeyValue("test2", "value")
.Done()
.Build();
var json = JsonConvert.SerializeObject(item);
Debug.Print(json);
}
}
}