forked from umbraco/Umbraco-CMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ability to remove trees in the backoffice
- Loading branch information
1 parent
d222972
commit 04f53b7
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...o.Tests.UnitTests/Umbraco.Web.BackOffice/CollectionBuilders/TreeCollectionBuilderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using Umbraco.Cms.Core.Trees; | ||
using Umbraco.Cms.Web.BackOffice.Trees; | ||
|
||
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.BackOffice.CollectionBuilders | ||
{ | ||
public class TreeCollectionBuilderTests | ||
{ | ||
[Test] | ||
public void Adding_Tree_To_Collection_Builder() | ||
{ | ||
var collectionBuilder = new TreeCollectionBuilder(); | ||
var treeDefinition = new Tree(0, "test", "test", "test", "test", TreeUse.Main, typeof(LanguageTreeController), false); | ||
|
||
collectionBuilder.AddTree(treeDefinition); | ||
var collection = collectionBuilder.CreateCollection(null); | ||
|
||
Assert.AreEqual(1, collection.Count); | ||
Assert.AreEqual(treeDefinition, collection.FirstOrDefault()); | ||
} | ||
|
||
[Test] | ||
public void Remove_Tree_From_Collection_Builder() | ||
{ | ||
var collectionBuilder = new TreeCollectionBuilder(); | ||
var treeDefinition = new Tree(0, "test", "test", "test", "test", TreeUse.Main, typeof(LanguageTreeController), false); | ||
|
||
collectionBuilder.AddTree(treeDefinition); | ||
collectionBuilder.RemoveTreeController<LanguageTreeController>(); | ||
var collection = collectionBuilder.CreateCollection(null); | ||
|
||
Assert.AreEqual(0, collection.Count); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters