Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v15/merge

# Conflicts:
#	Directory.Packages.props
#	tests/Directory.Packages.props
#	version.json
This commit is contained in:
nikolajlauridsen
2024-07-19 11:28:38 +02:00
110 changed files with 3375 additions and 897 deletions

View File

@@ -5,12 +5,21 @@
<ItemGroup>
<!-- Microsoft packages -->
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<<<<<<< HEAD
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0-preview.5.24306.11" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0-preview.5.24306.7" />
=======
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.6" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
>>>>>>> refs/remotes/origin/v14/dev
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageVersion Include="System.Data.Odbc" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="System.Data.OleDb" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0-preview.5.24306.11" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="System.Data.Odbc" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="System.Data.OleDb" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="System.Reflection.Emit" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
@@ -22,4 +31,4 @@
<PackageVersion Include="NUnit" Version="3.14.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" PrivateAssets="all" />
</ItemGroup>
</Project>
</Project>

View File

@@ -7,8 +7,8 @@
"name": "acceptancetest",
"hasInstallScript": true,
"dependencies": {
"@umbraco/json-models-builders": "^2.0.7",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.61",
"@umbraco/json-models-builders": "^2.0.9",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.65",
"camelize": "^1.0.0",
"dotenv": "^16.3.1",
"faker": "^4.1.0",
@@ -132,25 +132,19 @@
}
},
"node_modules/@umbraco/json-models-builders": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@umbraco/json-models-builders/-/json-models-builders-2.0.7.tgz",
"integrity": "sha512-roR5A+jzIFN9z1BhogMGOEzSzoR8jOrIYIAevT7EnyS3H3OM0m0uREgvjYCQo0+QMfVws4zq4Ydjx2TIfGYvlQ==",
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/@umbraco/json-models-builders/-/json-models-builders-2.0.9.tgz",
"integrity": "sha512-p6LjcE38WsFCvLtRRRVOCuMvris3OXeoueFu0FZBOHk2r7PXiqYCBUls/KbKxqpixzVDAb48RBd1hV7sKPcm5A==",
"dependencies": {
"camelize": "^1.0.1",
"faker": "^6.6.6"
"camelize": "^1.0.1"
}
},
"node_modules/@umbraco/json-models-builders/node_modules/faker": {
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/faker/-/faker-6.6.6.tgz",
"integrity": "sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg=="
},
"node_modules/@umbraco/playwright-testhelpers": {
"version": "2.0.0-beta.61",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.61.tgz",
"integrity": "sha512-Y2RqGrjfLDCZGDPyix4r8LoSl/YaluzY8RHLlkdcbL5GojDprzfB0jN9P3ZbrCDvnu9hydA8qE6ElPq/Zw5qXw==",
"version": "2.0.0-beta.65",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.65.tgz",
"integrity": "sha512-plSD/4hhVaMl2TItAaBOUQyuy0Qo5rW3EGIF0TvL3a01s6hNoW1DrOCZhWsOOsMTkgf+oScLEsVIBMk0uDLQrg==",
"dependencies": {
"@umbraco/json-models-builders": "2.0.7",
"@umbraco/json-models-builders": "2.0.9",
"camelize": "^1.0.0",
"faker": "^4.1.0",
"form-data": "^4.0.0",
@@ -219,12 +213,12 @@
}
},
"node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
"dependencies": {
"fill-range": "^7.0.1"
"fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
@@ -375,9 +369,9 @@
}
},
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"

View File

@@ -21,8 +21,8 @@
"wait-on": "^7.2.0"
},
"dependencies": {
"@umbraco/json-models-builders": "^2.0.7",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.61",
"@umbraco/json-models-builders": "^2.0.9",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.65",
"camelize": "^1.0.0",
"dotenv": "^16.3.1",
"faker": "^4.1.0",

View File

@@ -0,0 +1,85 @@
import { ConstantHelper, test, AliasHelper } from '@umbraco/playwright-testhelpers';
import {expect} from "@playwright/test";
const contentName = 'TestContent';
const documentTypeName = 'TestDocumentTypeForContent';
const dataTypeName = 'Checkbox list';
test.beforeEach(async ({umbracoApi, umbracoUi}) => {
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
await umbracoApi.document.ensureNameNotExists(contentName);
await umbracoUi.goToBackOffice();
});
test.afterEach(async ({umbracoApi}) => {
await umbracoApi.document.ensureNameNotExists(contentName);
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
});
test('can create content with the checkbox list data type', async ({umbracoApi, umbracoUi}) => {
// Arrange
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
// Act
await umbracoUi.content.clickActionsMenuAtRoot();
await umbracoUi.content.clickCreateButton();
await umbracoUi.content.chooseDocumentType(documentTypeName);
await umbracoUi.content.enterContentName(contentName);
await umbracoUi.content.clickSaveButton();
// Assert
await umbracoUi.content.isSuccessNotificationVisible();
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
const contentData = await umbracoApi.document.getByName(contentName);
expect(contentData.values).toEqual([]);
});
test('can publish content with the checkbox list data type', async ({umbracoApi, umbracoUi}) => {
// Arrange
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
// Act
await umbracoUi.content.clickActionsMenuAtRoot();
await umbracoUi.content.clickCreateButton();
await umbracoUi.content.chooseDocumentType(documentTypeName);
await umbracoUi.content.enterContentName(contentName);
await umbracoUi.content.clickSaveAndPublishButton();
// Assert
await umbracoUi.content.doesSuccessNotificationsHaveCount(2);
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
const contentData = await umbracoApi.document.getByName(contentName);
expect(contentData.values).toEqual([]);
});
test('can create content with the custom approved color data type', async ({umbracoApi, umbracoUi}) => {
// Arrange
const customDataTypeName = 'CustomCheckboxList';
const optionValues = ['testOption1', 'testOption2'];
const customDataTypeId = await umbracoApi.dataType.createCheckboxListDataType(customDataTypeName, optionValues);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
// Act
await umbracoUi.content.clickActionsMenuAtRoot();
await umbracoUi.content.clickCreateButton();
await umbracoUi.content.chooseDocumentType(documentTypeName);
await umbracoUi.content.enterContentName(contentName);
await umbracoUi.content.chooseCheckboxListOption(optionValues[0]);
await umbracoUi.content.clickSaveAndPublishButton();
// Assert
await umbracoUi.content.doesSuccessNotificationsHaveCount(2);
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
const contentData = await umbracoApi.document.getByName(contentName);
expect(contentData.values[0].alias).toEqual(AliasHelper.toAlias(customDataTypeName));
expect(contentData.values[0].value).toEqual([optionValues[0]]);
// Clean
await umbracoApi.dataType.ensureNameNotExists(customDataTypeName);
});

View File

@@ -15,64 +15,64 @@ test.afterEach(async ({umbracoApi}) => {
test('can create a dictionary item', async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoApi.dictionary.ensureNameNotExists(dictionaryName);
await umbracoUi.translation.goToSection(ConstantHelper.sections.translation);
await umbracoUi.dictionary.goToSection(ConstantHelper.sections.dictionary);
// Act
await umbracoUi.translation.clickCreateLink();
await umbracoUi.translation.enterDictionaryName(dictionaryName);
await umbracoUi.translation.clickSaveButton();
await umbracoUi.dictionary.clickCreateLink();
await umbracoUi.dictionary.enterDictionaryName(dictionaryName);
await umbracoUi.dictionary.clickSaveButton();
// Assert
expect(await umbracoApi.dictionary.doesNameExist(dictionaryName)).toBeTruthy();
await umbracoUi.translation.isSuccessNotificationVisible();
await umbracoUi.translation.clickLeftArrowButton();
await umbracoUi.dictionary.isSuccessNotificationVisible();
await umbracoUi.dictionary.clickLeftArrowButton();
// Verify the dictionary item displays in the tree and in the list
await umbracoUi.translation.isDictionaryTreeItemVisible(dictionaryName);
expect(await umbracoUi.translation.doesDictionaryListHaveText(dictionaryName)).toBeTruthy();
await umbracoUi.dictionary.isDictionaryTreeItemVisible(dictionaryName);
expect(await umbracoUi.dictionary.doesDictionaryListHaveText(dictionaryName)).toBeTruthy();
});
test('can delete a dictionary item', async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoApi.dictionary.ensureNameNotExists(dictionaryName);
await umbracoApi.dictionary.create(dictionaryName);
await umbracoUi.translation.goToSection(ConstantHelper.sections.translation);
await umbracoUi.dictionary.goToSection(ConstantHelper.sections.dictionary);
// Act
await umbracoUi.translation.clickActionsMenuForDictionary(dictionaryName);
await umbracoUi.translation.deleteDictionary();
await umbracoUi.dictionary.clickActionsMenuForDictionary(dictionaryName);
await umbracoUi.dictionary.deleteDictionary();
// Assert
await umbracoUi.translation.isSuccessNotificationVisible();
await umbracoUi.dictionary.isSuccessNotificationVisible();
expect(await umbracoApi.dictionary.doesNameExist(dictionaryName)).toBeFalsy();
// Verify the dictionary item does not display in the tree
await umbracoUi.translation.isDictionaryTreeItemVisible(dictionaryName, false);
await umbracoUi.dictionary.isDictionaryTreeItemVisible(dictionaryName, false);
// TODO: Uncomment this when the front-end is ready. Currently the dictionary list is not updated immediately.
// Verify the dictionary item does not display in the list
//expect(await umbracoUi.translation.doesDictionaryListHaveText(dictionaryName)).toBeFalsy();
//expect(await umbracoUi.dictionary.doesDictionaryListHaveText(dictionaryName)).toBeFalsy();
});
test('can create a dictionary item in a dictionary', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoApi.dictionary.ensureNameNotExists(parentDictionaryName);
let parentDictionaryId = await umbracoApi.dictionary.create(parentDictionaryName);
await umbracoUi.translation.goToSection(ConstantHelper.sections.translation);
await umbracoUi.dictionary.goToSection(ConstantHelper.sections.dictionary);
// Act
await umbracoUi.translation.clickActionsMenuForDictionary(parentDictionaryName);
await umbracoUi.translation.clickCreateDictionaryItemButton();
await umbracoUi.translation.enterDictionaryName(dictionaryName);
await umbracoUi.translation.clickSaveButton();
await umbracoUi.dictionary.clickActionsMenuForDictionary(parentDictionaryName);
await umbracoUi.dictionary.clickCreateDictionaryItemButton();
await umbracoUi.dictionary.enterDictionaryName(dictionaryName);
await umbracoUi.dictionary.clickSaveButton();
// Assert
await umbracoUi.translation.isSuccessNotificationVisible();
await umbracoUi.dictionary.isSuccessNotificationVisible();
const dictionaryChildren = await umbracoApi.dictionary.getChildren(parentDictionaryId);
expect(dictionaryChildren[0].name).toEqual(dictionaryName);
await umbracoUi.translation.clickLeftArrowButton();
await umbracoUi.dictionary.clickLeftArrowButton();
// Verify the new dictionary item displays in the list
expect(await umbracoUi.translation.doesDictionaryListHaveText(dictionaryName)).toBeTruthy();
expect(await umbracoUi.dictionary.doesDictionaryListHaveText(dictionaryName)).toBeTruthy();
// Verify the new dictionary item displays in the tree
await umbracoUi.translation.reloadTree(parentDictionaryName);
await umbracoUi.translation.isDictionaryTreeItemVisible(dictionaryName);
await umbracoUi.dictionary.reloadTree(parentDictionaryName);
await umbracoUi.dictionary.isDictionaryTreeItemVisible(dictionaryName);
// Clean
await umbracoApi.dictionary.ensureNameNotExists(parentDictionaryName);
@@ -82,12 +82,12 @@ test('can export a dictionary item', async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoApi.dictionary.ensureNameNotExists(dictionaryName);
const dictionaryId = await umbracoApi.dictionary.create(dictionaryName);
await umbracoUi.translation.goToSection(ConstantHelper.sections.translation);
await umbracoUi.dictionary.goToSection(ConstantHelper.sections.dictionary);
// Act
await umbracoUi.translation.clickActionsMenuForDictionary(dictionaryName);
await umbracoUi.translation.clickExportMenu();
const exportData = await umbracoUi.translation.exportDictionary(false);
await umbracoUi.dictionary.clickActionsMenuForDictionary(dictionaryName);
await umbracoUi.dictionary.clickExportMenu();
const exportData = await umbracoUi.dictionary.exportDictionary(false);
// Assert
expect(exportData).toEqual(dictionaryId + '.udt');
@@ -98,12 +98,12 @@ test('can export a dictionary item with descendants', {tag: '@smoke'}, async ({u
await umbracoApi.dictionary.ensureNameNotExists(parentDictionaryName);
let parentDictionaryId = await umbracoApi.dictionary.create(parentDictionaryName);
await umbracoApi.dictionary.create(dictionaryName, [], parentDictionaryId);
await umbracoUi.translation.goToSection(ConstantHelper.sections.translation);
await umbracoUi.dictionary.goToSection(ConstantHelper.sections.dictionary);
// Act
await umbracoUi.translation.clickActionsMenuForDictionary(parentDictionaryName);
await umbracoUi.translation.clickExportMenu();
const exportData = await umbracoUi.translation.exportDictionary(true);
await umbracoUi.dictionary.clickActionsMenuForDictionary(parentDictionaryName);
await umbracoUi.dictionary.clickExportMenu();
const exportData = await umbracoUi.dictionary.exportDictionary(true);
// Assert
expect(exportData).toEqual(parentDictionaryId + '.udt');
@@ -119,20 +119,20 @@ test('can import a dictionary item', async ({umbracoApi, umbracoUi}) => {
const importDictionaryName = 'TestImportDictionary';
await umbracoApi.dictionary.ensureNameNotExists(dictionaryName);
await umbracoApi.dictionary.create(dictionaryName);
await umbracoUi.translation.goToSection(ConstantHelper.sections.translation);
await umbracoUi.dictionary.goToSection(ConstantHelper.sections.dictionary);
// Act
await umbracoUi.translation.clickActionsMenuForDictionary(dictionaryName);
await umbracoUi.translation.clickImportMenu();
await umbracoUi.translation.importDictionary(udtFilePath);
await umbracoUi.dictionary.clickActionsMenuForDictionary(dictionaryName);
await umbracoUi.dictionary.clickImportMenu();
await umbracoUi.dictionary.importDictionary(udtFilePath);
// Assert
// Verify the imported dictionary item displays in the tree
await umbracoUi.translation.reloadTree(dictionaryName);
await umbracoUi.translation.isDictionaryTreeItemVisible(importDictionaryName);
await umbracoUi.dictionary.reloadTree(dictionaryName);
await umbracoUi.dictionary.isDictionaryTreeItemVisible(importDictionaryName);
// TODO: Uncomment this when the front-end is ready. Currently the dictionary list is not updated immediately.
// Verify the imported dictionary item displays in the list
//expect(await umbracoUi.translation.doesDictionaryListHaveText(importDictionaryName)).toBeTruthy();
//expect(await umbracoUi.dictionary.doesDictionaryListHaveText(importDictionaryName)).toBeTruthy();
});
test('can import a dictionary item with descendants', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
@@ -143,23 +143,23 @@ test('can import a dictionary item with descendants', {tag: '@smoke'}, async ({u
const importChildDictionaryName = 'TestImportChild';
await umbracoApi.dictionary.ensureNameNotExists(dictionaryName);
await umbracoApi.dictionary.create(dictionaryName);
await umbracoUi.translation.goToSection(ConstantHelper.sections.translation);
await umbracoUi.dictionary.goToSection(ConstantHelper.sections.dictionary);
// Act
await umbracoUi.translation.clickActionsMenuForDictionary(dictionaryName);
await umbracoUi.translation.clickImportMenu();
await umbracoUi.translation.importDictionary(udtFilePath);
await umbracoUi.dictionary.clickActionsMenuForDictionary(dictionaryName);
await umbracoUi.dictionary.clickImportMenu();
await umbracoUi.dictionary.importDictionary(udtFilePath);
// Assert
// Verify the imported dictionary items display in the tree
await umbracoUi.translation.reloadTree(dictionaryName);
await umbracoUi.translation.isDictionaryTreeItemVisible(importParentDictionaryName);
await umbracoUi.translation.reloadTree(importParentDictionaryName);
await umbracoUi.translation.isDictionaryTreeItemVisible(importChildDictionaryName);
await umbracoUi.dictionary.reloadTree(dictionaryName);
await umbracoUi.dictionary.isDictionaryTreeItemVisible(importParentDictionaryName);
await umbracoUi.dictionary.reloadTree(importParentDictionaryName);
await umbracoUi.dictionary.isDictionaryTreeItemVisible(importChildDictionaryName);
// TODO: Uncomment this when the front-end is ready. Currently the dictionary list is not updated immediately.
// Verify the imported dictionary items display in the list
//expect(await umbracoUi.translation.doesDictionaryListHaveText(importParentDictionaryName)).toBeTruthy();
//expect(await umbracoUi.translation.doesDictionaryListHaveText(importChildDictionaryName)).toBeTruthy();
//expect(await umbracoUi.dictionary.doesDictionaryListHaveText(importParentDictionaryName)).toBeTruthy();
//expect(await umbracoUi.dictionary.doesDictionaryListHaveText(importChildDictionaryName)).toBeTruthy();
});
// Skip this test as the search function is removed
@@ -167,13 +167,13 @@ test.skip('can search a dictionary item in list when have results', async ({umbr
// Arrange
await umbracoApi.dictionary.ensureNameNotExists(dictionaryName);
await umbracoApi.dictionary.create(dictionaryName);
await umbracoUi.translation.goToSection(ConstantHelper.sections.translation);
await umbracoUi.dictionary.goToSection(ConstantHelper.sections.dictionary);
// Act
await umbracoUi.translation.enterSearchKeywordAndPressEnter(dictionaryName);
await umbracoUi.dictionary.enterSearchKeywordAndPressEnter(dictionaryName);
// Assert
expect(await umbracoUi.translation.doesDictionaryListHaveText(dictionaryName)).toBeTruthy();
expect(await umbracoUi.dictionary.doesDictionaryListHaveText(dictionaryName)).toBeTruthy();
});
// Skip this test as the search function is removed
@@ -182,11 +182,11 @@ test.skip('can search a dictionary item in list when have no results', async ({u
const emptySearchResultMessage = 'No Dictionary items to choose from';
await umbracoApi.dictionary.ensureNameNotExists(dictionaryName);
await umbracoApi.dictionary.create(dictionaryName);
await umbracoUi.translation.goToSection(ConstantHelper.sections.translation);
await umbracoUi.dictionary.goToSection(ConstantHelper.sections.dictionary);
// Act
await umbracoUi.translation.enterSearchKeywordAndPressEnter('xyz');
await umbracoUi.dictionary.enterSearchKeywordAndPressEnter('xyz');
// Assert
await umbracoUi.translation.isSearchResultMessageDisplayEmpty(emptySearchResultMessage);
await umbracoUi.dictionary.isSearchResultMessageDisplayEmpty(emptySearchResultMessage);
});

View File

@@ -278,6 +278,8 @@ namespace Umbraco.Cms.Tests.Integration.TestServerTest
// Adds Umbraco.Tests.Integration
mvcBuilder.AddApplicationPart(typeof(UmbracoTestServerTestBase).Assembly);
CustomMvcSetup(mvcBuilder);
})
.AddWebServer()
.AddWebsite()
@@ -294,6 +296,11 @@ namespace Umbraco.Cms.Tests.Integration.TestServerTest
builder.Build();
}
protected virtual void CustomMvcSetup(IMvcBuilder mvcBuilder)
{
}
/// <summary>
/// Hook for registering test doubles.
/// </summary>

View File

@@ -136,6 +136,12 @@ public abstract class UmbracoIntegrationTest : UmbracoIntegrationTestBase
services.AddLogger(webHostEnvironment, Configuration);
// Register a keyed service to verify that all calls to ServiceDescriptor.ImplementationType
// are guarded by checking IsKeyedService first.
// Failure to check this when accessing a keyed service descriptor's ImplementationType property
// throws a InvalidOperationException.
services.AddKeyedSingleton<object>("key");
// Add it!
var hostingEnvironment = TestHelper.GetHostingEnvironment();
var typeLoader = services.AddTypeLoader(

View File

@@ -36,7 +36,7 @@ public class LocksTests : UmbracoIntegrationTest
protected override void ConfigureTestServices(IServiceCollection services) =>
// SQLite + retry policy makes tests fail, we retry before throwing distributed locking timeout.
services.RemoveAll(x => x.ImplementationType == typeof(SqliteAddRetryPolicyInterceptor));
services.RemoveAll(x => !x.IsKeyedService && x.ImplementationType == typeof(SqliteAddRetryPolicyInterceptor));
[Test]
public void SingleReadLockTest()

View File

@@ -23,7 +23,7 @@ public class EFCoreLockTests : UmbracoIntegrationTest
protected override void ConfigureTestServices(IServiceCollection services)
{
// SQLite + retry policy makes tests fail, we retry before throwing distributed locking timeout.
services.RemoveAll(x => x.ImplementationType == typeof(SqliteAddRetryPolicyInterceptor));
services.RemoveAll(x => !x.IsKeyedService && x.ImplementationType == typeof(SqliteAddRetryPolicyInterceptor));
// Remove all locking implementations to ensure we only use EFCoreDistributedLockingMechanisms
services.RemoveAll(x => x.ServiceType == typeof(IDistributedLockingMechanism));

View File

@@ -0,0 +1,48 @@
using Microsoft.AspNetCore.Http;
using Moq;
using NUnit.Framework;
using Umbraco.Cms.Api.Delivery.Services;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Cms.Api.Delivery.Services;
[TestFixture]
public class RequestHeaderHandlerTests
{
private const string HeaderName = "TestHeader";
[Test]
public void GetHeaderValue_return_null_when_http_context_is_unavailable()
{
IHttpContextAccessor httpContextAccessor = Mock.Of<IHttpContextAccessor>();
var sut = new TestRequestHeaderHandler(httpContextAccessor);
Assert.IsNull(sut.TestGetHeaderValue(HeaderName));
}
[Test]
public void GetHeaderValue_return_header_value_when_http_context_is_available()
{
const string headerValue = "TestValue";
HttpContext httpContext = new DefaultHttpContext();
httpContext.Request.Headers[HeaderName] = headerValue;
IHttpContextAccessor httpContextAccessor = Mock.Of<IHttpContextAccessor>();
Mock.Get(httpContextAccessor).Setup(x => x.HttpContext).Returns(httpContext);
var sut = new TestRequestHeaderHandler(httpContextAccessor);
Assert.AreEqual(headerValue, sut.TestGetHeaderValue(HeaderName));
}
}
internal class TestRequestHeaderHandler : RequestHeaderHandler
{
public TestRequestHeaderHandler(IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor)
{
}
public string? TestGetHeaderValue(string headerName) => base.GetHeaderValue(headerName);
}

View File

@@ -21,7 +21,7 @@ public class ApiMediaUrlProviderTests : PropertyValueConverterTests
var publishedUrlProvider = new Mock<IPublishedUrlProvider>();
publishedUrlProvider
.Setup(p => p.GetMediaUrl(content.Object, UrlMode.Relative, It.IsAny<string?>(), It.IsAny<string?>(), It.IsAny<Uri?>()))
.Setup(p => p.GetMediaUrl(content.Object, UrlMode.Default, It.IsAny<string?>(), It.IsAny<string?>(), It.IsAny<Uri?>()))
.Returns(publishedUrl);
var apiMediaUrlProvider = new ApiMediaUrlProvider(publishedUrlProvider.Object);

View File

@@ -9,7 +9,6 @@ using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.PropertyEditors.ValueConverters;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Infrastructure.DeliveryApi;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.DeliveryApi;
@@ -474,7 +473,7 @@ public class RichTextParserTests : PropertyValueConverterTests
Mock.Of<ILogger<ApiRichTextMarkupParser>>());
}
private void SetupTestContent(out IApiContentRouteBuilder routeBuilder, out IPublishedSnapshotAccessor snapshotAccessor, out IPublishedUrlProvider urlProvider)
private void SetupTestContent(out IApiContentRouteBuilder routeBuilder, out IPublishedSnapshotAccessor snapshotAccessor, out IApiMediaUrlProvider apiMediaUrlProvider)
{
var contentMock = new Mock<IPublishedContent>();
contentMock.SetupGet(m => m.Key).Returns(_contentKey);
@@ -502,14 +501,14 @@ public class RichTextParserTests : PropertyValueConverterTests
.Setup(m => m.Build(contentMock.Object, null))
.Returns(new ApiContentRoute("/some-content-path", new ApiContentStartItem(_contentRootKey, "the-root-path")));
var urlProviderMock = new Mock<IPublishedUrlProvider>();
urlProviderMock
.Setup(m => m.GetMediaUrl(mediaMock.Object, It.IsAny<UrlMode>(), It.IsAny<string?>(), It.IsAny<string>(), It.IsAny<Uri?>()))
var apiMediaUrlProviderMock = new Mock<IApiMediaUrlProvider>();
apiMediaUrlProviderMock
.Setup(m => m.GetUrl(mediaMock.Object))
.Returns("/some-media-url");
routeBuilder = routeBuilderMock.Object;
snapshotAccessor = snapshotAccessorMock.Object;
urlProvider = urlProviderMock.Object;
apiMediaUrlProvider = apiMediaUrlProviderMock.Object;
}
private IPublishedElement CreateElement(Guid id, int propertyValue)

View File

@@ -2,6 +2,7 @@
using Moq;
using NUnit.Framework;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Cache.PropertyEditors;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Models.Blocks;
using Umbraco.Cms.Core.PropertyEditors;
@@ -43,7 +44,7 @@ public class DataValueEditorReuseTests
_propertyEditorCollection,
_dataValueReferenceFactories,
Mock.Of<IDataTypeConfigurationCache>(),
Mock.Of<IContentTypeService>(),
Mock.Of<IBlockEditorElementTypeCache>(),
Mock.Of<ILocalizedTextService>(),
Mock.Of<ILogger<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>>(),
Mock.Of<IShortStringHelper>(),

View File

@@ -31,7 +31,7 @@ public class ContentFinderByAliasWithDomainsTests : UrlRoutingTestBase
var request = await publishedRouter.CreateRequestAsync(umbracoContext.CleanedUmbracoUrl);
// must lookup domain
publishedRouter.FindDomain(request);
publishedRouter.FindAndSetDomain(request);
if (expectedNode > 0)
{

View File

@@ -207,7 +207,7 @@ public class ContentFinderByUrlWithDomainsTests : UrlRoutingTestBase
var frequest = await publishedRouter.CreateRequestAsync(umbracoContext.CleanedUmbracoUrl);
// must lookup domain else lookup by URL fails
publishedRouter.FindDomain(frequest);
publishedRouter.FindAndSetDomain(frequest);
var lookup = new ContentFinderByUrl(Mock.Of<ILogger<ContentFinderByUrl>>(), umbracoContextAccessor);
var result = await lookup.TryFindContent(frequest);
@@ -245,7 +245,7 @@ public class ContentFinderByUrlWithDomainsTests : UrlRoutingTestBase
var frequest = await publishedRouter.CreateRequestAsync(umbracoContext.CleanedUmbracoUrl);
// must lookup domain else lookup by URL fails
publishedRouter.FindDomain(frequest);
publishedRouter.FindAndSetDomain(frequest);
Assert.AreEqual(expectedCulture, frequest.Culture);
var lookup = new ContentFinderByUrl(Mock.Of<ILogger<ContentFinderByUrl>>(), umbracoContextAccessor);

View File

@@ -261,7 +261,7 @@ public class DomainsAndCulturesTests : UrlRoutingTestBase
var frequest = await publishedRouter.CreateRequestAsync(umbracoContext.CleanedUmbracoUrl);
// lookup domain
publishedRouter.FindDomain(frequest);
publishedRouter.FindAndSetDomain(frequest);
Assert.AreEqual(expectedCulture, frequest.Culture);
@@ -310,7 +310,7 @@ public class DomainsAndCulturesTests : UrlRoutingTestBase
var frequest = await publishedRouter.CreateRequestAsync(umbracoContext.CleanedUmbracoUrl);
// lookup domain
publishedRouter.FindDomain(frequest);
publishedRouter.FindAndSetDomain(frequest);
// find document
var finder = new ContentFinderByUrl(Mock.Of<ILogger<ContentFinderByUrl>>(), umbracoContextAccessor);
@@ -345,7 +345,7 @@ public class DomainsAndCulturesTests : UrlRoutingTestBase
var frequest = await publishedRouter.CreateRequestAsync(umbracoContext.CleanedUmbracoUrl);
// lookup domain
publishedRouter.FindDomain(frequest);
publishedRouter.FindAndSetDomain(frequest);
Assert.IsNotNull(frequest.Domain);
Assert.AreEqual(expectedCulture, frequest.Culture);

View File

@@ -62,7 +62,7 @@ public class UrlsWithNestedDomains : UrlRoutingTestBase
var publishedRouter = CreatePublishedRouter(umbracoContextAccessor);
var frequest = await publishedRouter.CreateRequestAsync(umbracoContext.CleanedUmbracoUrl);
publishedRouter.FindDomain(frequest);
publishedRouter.FindAndSetDomain(frequest);
Assert.IsTrue(frequest.HasDomain());
// check that it's been routed

View File

@@ -13,6 +13,7 @@ using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Templates;
using Umbraco.Cms.Tests.Common;
using Umbraco.Cms.Tests.UnitTests.TestHelpers.Objects;
using Umbraco.Extensions;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Templates;
@@ -21,6 +22,32 @@ public class HtmlLocalLinkParserTests
{
[Test]
public void Returns_Udis_From_LocalLinks()
{
var input = @"<p>
<div>
<img src='/media/12312.jpg' data-udi='umb://media/D4B18427A1544721B09AC7692F35C264' />
<a type=""document"" href=""/{localLink:eed5fc6b-96fd-45a5-a0f1-b1adfb483c2f}"" title=""other page"">other page</a>
</div>
</p><p><img src='/media/234234.jpg' data-udi=""umb://media-type/B726D735E4C446D58F703F3FBCFC97A5"" />
<a type=""media"" href=""/{localLink:7e21a725-b905-4c5f-86dc-8c41ec116e39}"" title=""media"">media</a>
</p>";
var umbracoContextAccessor = new TestUmbracoContextAccessor();
var parser = new HtmlLocalLinkParser(umbracoContextAccessor, Mock.Of<IPublishedUrlProvider>());
var result = parser.FindUdisFromLocalLinks(input).ToList();
Assert.Multiple(() =>
{
Assert.AreEqual(2, result.Count);
Assert.Contains(UdiParser.Parse("umb://document/eed5fc6b-96fd-45a5-a0f1-b1adfb483c2f"), result);
Assert.Contains(UdiParser.Parse("umb://media/7e21a725-b905-4c5f-86dc-8c41ec116e39"), result);
});
}
// todo remove at some point and the implementation.
[Test]
public void Returns_Udis_From_Legacy_LocalLinks()
{
var input = @"<p>
<div>
@@ -36,12 +63,59 @@ public class HtmlLocalLinkParserTests
var result = parser.FindUdisFromLocalLinks(input).ToList();
Assert.AreEqual(2, result.Count);
Assert.AreEqual(UdiParser.Parse("umb://document/C093961595094900AAF9170DDE6AD442"), result[0]);
Assert.AreEqual(UdiParser.Parse("umb://document-type/2D692FCB070B4CDA92FB6883FDBFD6E2"), result[1]);
Assert.Multiple(() =>
{
Assert.AreEqual(2, result.Count);
Assert.Contains(UdiParser.Parse("umb://document/C093961595094900AAF9170DDE6AD442"), result);
Assert.Contains(UdiParser.Parse("umb://document-type/2D692FCB070B4CDA92FB6883FDBFD6E2"), result);
});
}
// todo remove at some point and the implementation.
[Test]
public void Returns_Udis_From_Legacy_And_Current_LocalLinks()
{
var input = @"<p>
<div>
<img src='/media/12312.jpg' data-udi='umb://media/D4B18427A1544721B09AC7692F35C264' />
<a href=""{locallink:umb://document/C093961595094900AAF9170DDE6AD442}"">hello</a>
</div>
</p><p><img src='/media/234234.jpg' data-udi=""umb://media-type/B726D735E4C446D58F703F3FBCFC97A5"" />
<a href=""{locallink:umb://document-type/2D692FCB070B4CDA92FB6883FDBFD6E2}"">hello</a>
</p>
<p>
<div>
<img src='/media/12312.jpg' data-udi='umb://media/D4B18427A1544721B09AC7692F35C264' />
<a type=""document"" href=""/{localLink:eed5fc6b-96fd-45a5-a0f1-b1adfb483c2f}"" title=""other page"">other page</a>
</div>
</p><p><img src='/media/234234.jpg' data-udi=""umb://media-type/B726D735E4C446D58F703F3FBCFC97A5"" />
<a type=""media"" href=""/{localLink:7e21a725-b905-4c5f-86dc-8c41ec116e39}"" title=""media"">media</a>
</p>";
var umbracoContextAccessor = new TestUmbracoContextAccessor();
var parser = new HtmlLocalLinkParser(umbracoContextAccessor, Mock.Of<IPublishedUrlProvider>());
var result = parser.FindUdisFromLocalLinks(input).ToList();
Assert.Multiple(() =>
{
Assert.AreEqual(4, result.Count);
Assert.Contains(UdiParser.Parse("umb://document/eed5fc6b-96fd-45a5-a0f1-b1adfb483c2f"), result);
Assert.Contains(UdiParser.Parse("umb://media/7e21a725-b905-4c5f-86dc-8c41ec116e39"), result);
Assert.Contains(UdiParser.Parse("umb://document/C093961595094900AAF9170DDE6AD442"), result);
Assert.Contains(UdiParser.Parse("umb://document-type/2D692FCB070B4CDA92FB6883FDBFD6E2"), result);
});
}
[TestCase("", "")]
// current
[TestCase(
"<a type=\"document\" href=\"/{localLink:9931BDE0-AAC3-4BAB-B838-909A7B47570E}\" title=\"world\">world</a>",
"<a type=\"document\" href=\"/my-test-url\" title=\"world\">world</a>")]
[TestCase(
"<a type=\"media\" href=\"/{localLink:9931BDE0-AAC3-4BAB-B838-909A7B47570E}\" title=\"world\">world</a>",
"<a type=\"media\" href=\"/media/1001/my-image.jpg\" title=\"world\">world</a>")]
// legacy
[TestCase(
"hello href=\"{localLink:1234}\" world ",
"hello href=\"/my-test-url\" world ")]

View File

@@ -0,0 +1,200 @@
using Microsoft.Extensions.Logging;
using Moq;
using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.DeliveryApi;
using Umbraco.Cms.Core.Models.DeliveryApi;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Infrastructure.DeliveryApi;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Infrastructure.DeliveryApi;
[TestFixture]
public class ApiRichTextMarkupParserTests
{
private Mock<IApiContentRouteBuilder> _apiContentRouteBuilder;
private Mock<IApiMediaUrlProvider> _apiMediaUrlProvider;
private Mock<IPublishedSnapshotAccessor> _publishedSnapshotAccessor;
[Test]
public void Can_Parse_Legacy_LocalLinks()
{
var key1 = Guid.Parse("a1c5d649977f4ea59b1cb26055f3eed3");
var data1 = new MockData()
.WithKey(key1)
.WithRoutePath("/inline/")
.WithRouteStartPath("inline");
var mockData = new Dictionary<Guid, MockData>
{
{ key1, data1 },
};
var parser = BuildDefaultSut(mockData);
var legacyHtml =
"<p><a href=\"/{localLink:umb://document/a1c5d649977f4ea59b1cb26055f3eed3}\" title=\"Inline\">link </a>to another page</p>";
var expectedOutput =
"<p><a href=\"/inline/\" title=\"Inline\" data-start-item-path=\"inline\" data-start-item-id=\"a1c5d649-977f-4ea5-9b1c-b26055f3eed3\">link </a>to another page</p>";
var parsedHtml = parser.Parse(legacyHtml);
Assert.AreEqual(expectedOutput, parsedHtml);
}
[Test]
public void Can_Parse_LocalLinks()
{
var key1 = Guid.Parse("eed5fc6b-96fd-45a5-a0f1-b1adfb483c2f");
var data1 = new MockData()
.WithKey(key1)
.WithRoutePath("/self/")
.WithRouteStartPath("self");
var key2 = Guid.Parse("cc143afe-4cbf-46e5-b399-c9f451384373");
var data2 = new MockData()
.WithKey(key2)
.WithRoutePath("/other/")
.WithRouteStartPath("other");
var mockData = new Dictionary<Guid, MockData>
{
{ key1, data1 },
{ key2, data2 },
};
var parser = BuildDefaultSut(mockData);
var html =
@"<p>Rich text outside of the blocks with a link to <a type=""document"" href=""/{localLink:eed5fc6b-96fd-45a5-a0f1-b1adfb483c2f}"" title=""itself"">itself</a><br><br></p>
<p>and to the <a type=""document"" href=""/{localLink:cc143afe-4cbf-46e5-b399-c9f451384373}"" title=""other page"">other page</a></p>";
var expectedOutput =
@"<p>Rich text outside of the blocks with a link to <a type=""document"" href=""/self/"" title=""itself"" data-start-item-path=""self"" data-start-item-id=""eed5fc6b-96fd-45a5-a0f1-b1adfb483c2f"">itself</a><br><br></p>
<p>and to the <a type=""document"" href=""/other/"" title=""other page"" data-start-item-path=""other"" data-start-item-id=""cc143afe-4cbf-46e5-b399-c9f451384373"">other page</a></p>";
var parsedHtml = parser.Parse(html);
Assert.AreEqual(expectedOutput, parsedHtml);
}
[Test]
public void Can_Parse_Legacy_LocalImages()
{
var key1 = Guid.Parse("395bdc0e8f4d4ad4af7f3a3f6265651e");
var data1 = new MockData()
.WithKey(key1)
.WithMediaUrl("https://localhost:44331/media/bdofwokn/77gtp8fbrxmgkefatp10aw.webp");
var mockData = new Dictionary<Guid, MockData>
{
{ key1, data1 },
};
var parser = BuildDefaultSut(mockData);
var legacyHtml =
@"<p>An image</p>\n<p><img src=""/media/bdofwokn/77gtp8fbrxmgkefatp10aw.webp?rmode=max&amp;width=500&amp;height=500"" alt="""" width=""500"" height=""500"" data-udi=""umb://media/395bdc0e8f4d4ad4af7f3a3f6265651e""></p>";
var expectedOutput =
@"<p>An image</p>\n<p><img src=""https://localhost:44331/media/bdofwokn/77gtp8fbrxmgkefatp10aw.webp?rmode=max&amp;width=500&amp;height=500"" alt="""" width=""500"" height=""500""></p>";
var parsedHtml = parser.Parse(legacyHtml);
Assert.AreEqual(expectedOutput, parsedHtml);
}
private ApiRichTextMarkupParser BuildDefaultSut(Dictionary<Guid, MockData> mockData)
{
var contentCacheMock = new Mock<IPublishedContentCache>();
contentCacheMock.Setup(cc => cc.GetById(It.IsAny<bool>(), It.IsAny<Guid>()))
.Returns<bool, Guid>((preview, key) => mockData[key].PublishedContent);
contentCacheMock.Setup(cc => cc.GetById(It.IsAny<Guid>()))
.Returns<Guid>(key => mockData[key].PublishedContent);
contentCacheMock.Setup(cc => cc.GetById(It.IsAny<bool>(), It.IsAny<Udi>()))
.Returns<bool, Udi>((preview, udi) => mockData[((GuidUdi)udi).Guid].PublishedContent);
contentCacheMock.Setup(cc => cc.GetById(It.IsAny<Udi>()))
.Returns<Udi>(udi => mockData[((GuidUdi)udi).Guid].PublishedContent);
var mediaCacheMock = new Mock<IPublishedMediaCache>();
mediaCacheMock.Setup(cc => cc.GetById(It.IsAny<bool>(), It.IsAny<Guid>()))
.Returns<bool, Guid>((preview, key) => mockData[key].PublishedContent);
mediaCacheMock.Setup(cc => cc.GetById(It.IsAny<Guid>()))
.Returns<Guid>(key => mockData[key].PublishedContent);
mediaCacheMock.Setup(cc => cc.GetById(It.IsAny<bool>(), It.IsAny<Udi>()))
.Returns<bool, Udi>((preview, udi) => mockData[((GuidUdi)udi).Guid].PublishedContent);
mediaCacheMock.Setup(cc => cc.GetById(It.IsAny<Udi>()))
.Returns<Udi>(udi => mockData[((GuidUdi)udi).Guid].PublishedContent);
var snapshotMock = new Mock<IPublishedSnapshot>();
snapshotMock.SetupGet(ss => ss.Content)
.Returns(contentCacheMock.Object);
snapshotMock.SetupGet(ss => ss.Media)
.Returns(mediaCacheMock.Object);
var snapShot = snapshotMock.Object;
_publishedSnapshotAccessor = new Mock<IPublishedSnapshotAccessor>();
_publishedSnapshotAccessor.Setup(psa => psa.TryGetPublishedSnapshot(out snapShot))
.Returns(true);
_apiMediaUrlProvider = new Mock<IApiMediaUrlProvider>();
_apiMediaUrlProvider.Setup(mup => mup.GetUrl(It.IsAny<IPublishedContent>()))
.Returns<IPublishedContent>(ipc => mockData[ipc.Key].MediaUrl);
_apiContentRouteBuilder = new Mock<IApiContentRouteBuilder>();
_apiContentRouteBuilder.Setup(acrb => acrb.Build(It.IsAny<IPublishedContent>(), It.IsAny<string>()))
.Returns<IPublishedContent, string>((content, culture) => mockData[content.Key].ApiContentRoute);
return new ApiRichTextMarkupParser(
_apiContentRouteBuilder.Object,
_apiMediaUrlProvider.Object,
_publishedSnapshotAccessor.Object,
Mock.Of<ILogger<ApiRichTextMarkupParser>>());
}
private class MockData
{
private Mock<IPublishedContent> _publishedContentMock = new Mock<IPublishedContent>();
private Mock<IApiContentRoute> _apiContentRouteMock = new Mock<IApiContentRoute>();
private Mock<IApiContentStartItem> _apiContentStartItem = new Mock<IApiContentStartItem>();
public IPublishedContent PublishedContent => _publishedContentMock.Object;
public IApiContentRoute ApiContentRoute => _apiContentRouteMock.Object;
public string MediaUrl { get; set; } = string.Empty;
public MockData()
{
_apiContentRouteMock.SetupGet(r => r.StartItem).Returns(_apiContentStartItem.Object);
}
public MockData WithKey(Guid key)
{
_publishedContentMock.SetupGet(i => i.Key).Returns(key);
_apiContentStartItem.SetupGet(rsi => rsi.Id).Returns(key);
return this;
}
public MockData WithRoutePath(string path)
{
_apiContentRouteMock.SetupGet(r => r.Path).Returns(path);
return this;
}
public MockData WithRouteStartPath(string path)
{
_apiContentStartItem.SetupGet(rsi => rsi.Path).Returns(path);
return this;
}
public MockData WithMediaUrl(string url)
{
MediaUrl = url;
return this;
}
}
}

View File

@@ -45,7 +45,7 @@ public class BackOfficeAreaRoutesTests
var endpoints = new TestRouteBuilder();
routes.CreateRoutes(endpoints);
Assert.AreEqual(1, endpoints.DataSources.Count);
Assert.AreEqual(2, endpoints.DataSources.Count);
var route = endpoints.DataSources.First();
Assert.AreEqual(2, route.Endpoints.Count);