2020-12-20 08:36:11 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2020-10-21 21:04:10 +02:00
|
|
|
using System.IO;
|
2020-07-04 15:07:07 +02:00
|
|
|
using NUnit.Framework;
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Core.Routing;
|
|
|
|
|
using Umbraco.Cms.Tests.Common.Builders;
|
2020-04-04 09:25:50 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Tests.Common.Builders;
|
|
|
|
|
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class StylesheetBuilderTests
|
2020-04-04 09:25:50 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
[Test]
|
|
|
|
|
public void Is_Built_Correctly()
|
2020-04-04 09:25:50 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
// Arrange
|
|
|
|
|
var testPath = WebPath.PathSeparator + WebPath.Combine("css", "styles.css");
|
|
|
|
|
const string testContent = @"body { color:#000; } .bold {font-weight:bold;}";
|
2020-04-04 09:25:50 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
var builder = new StylesheetBuilder();
|
2020-04-04 09:25:50 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
// Act
|
|
|
|
|
var stylesheet = builder
|
|
|
|
|
.WithPath(testPath)
|
|
|
|
|
.WithContent(testContent)
|
|
|
|
|
.Build();
|
2020-04-04 09:25:50 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
// Assert
|
|
|
|
|
Assert.AreEqual(Path.DirectorySeparatorChar + Path.Combine("css", "styles.css"), stylesheet.Path);
|
|
|
|
|
Assert.AreEqual(testContent, stylesheet.Content);
|
2020-04-04 09:25:50 +02:00
|
|
|
}
|
|
|
|
|
}
|