Files
Umbraco-CMS/tests/Umbraco.Tests.UnitTests/Umbraco.Web.Common/Macros/MacroTests.cs

40 lines
1008 B
C#
Raw Normal View History

// Copyright (c) Umbraco.
// See LICENSE for more details.
using NUnit.Framework;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Macros;
using Umbraco.Cms.Web.Common.Macros;
2018-06-29 19:52:40 +02:00
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.Common.Macros;
[TestFixture]
public class MacroTests
2018-06-29 19:52:40 +02:00
{
[SetUp]
public void Setup()
2018-06-29 19:52:40 +02:00
{
// We DO want cache enabled for these tests
var cacheHelper = new AppCaches(
new ObjectCacheAppCache(),
NoAppCache.Instance,
new IsolatedCaches(type => new ObjectCacheAppCache()));
}
[TestCase("anything", true)]
[TestCase("", false)]
public void Macro_Is_File_Based(string macroSource, bool expectedNonNull)
{
var model = new MacroModel { MacroSource = macroSource };
var filename = MacroRenderer.GetMacroFileName(model);
if (expectedNonNull)
2018-06-29 19:52:40 +02:00
{
Assert.IsNotNull(filename);
2018-06-29 19:52:40 +02:00
}
else
2018-06-29 19:52:40 +02:00
{
Assert.IsNull(filename);
2018-06-29 19:52:40 +02:00
}
}
}