Browse Source

remove content from cms-kit

pull/7911/head
Ahmet 6 years ago
parent
commit
2c089a2443
  1. 7
      modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs
  2. 71
      modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs
  3. 1
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml
  4. 1
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml
  5. 44
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs
  6. 7
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml
  7. 80
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js
  8. 28
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs
  9. 27
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml
  10. 65
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs
  11. 34
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js
  12. 2
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml
  13. 11
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml
  14. 44
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs
  15. 17
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentAlreadyExistException.cs
  16. 32
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentManager.cs
  17. 11
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentManager.cs
  18. 35
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentRepository.cs
  19. 86
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Contents/EfCoreContentRepository.cs
  20. 2
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs
  21. 21
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs
  22. 1
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs
  23. 2
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs
  24. 2
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs
  25. 5
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs
  26. 3
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs
  27. 80
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs
  28. 2
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs
  29. 25
      modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Contents/ContentPublicAppService.cs
  30. 4
      modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs
  31. 142
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs
  32. 9
      modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Contents/ContentRepository_Test.cs
  33. 11
      modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Contents/ContentRepository_Test.cs
  34. 39
      modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs
  35. 63
      modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs

7
modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs

@ -2,13 +2,11 @@
using Volo.Abp.AutoMapper;
using Volo.CmsKit.Admin.Blogs;
using Volo.CmsKit.Admin.Comments;
using Volo.CmsKit.Admin.Contents;
using Volo.CmsKit.Admin.MediaDescriptors;
using Volo.CmsKit.Admin.Pages;
using Volo.CmsKit.Blogs;
using Volo.CmsKit.Admin.Tags;
using Volo.CmsKit.Comments;
using Volo.CmsKit.Contents;
using Volo.CmsKit.MediaDescriptors;
using Volo.CmsKit.Pages;
using Volo.CmsKit.Tags;
@ -28,11 +26,6 @@ namespace Volo.CmsKit.Admin
CreateMap<Page, PageDto>();
CreateMap<Content, ContentDto>(MemberList.Destination);
CreateMap<Content, ContentGetListDto>(MemberList.Destination);
CreateMap<ContentCreateDto, Content>(MemberList.Source);
CreateMap<ContentUpdateDto, Content>(MemberList.Source);
CreateMap<BlogPost, BlogPostDto>(MemberList.Destination);
CreateMap<CreateBlogPostDto, BlogPost>(MemberList.Source);
CreateMap<UpdateBlogPostDto, BlogPost>(MemberList.Source);

71
modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs

@ -1,71 +0,0 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.Authorization;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.CmsKit.Contents;
using Volo.CmsKit.Permissions;
namespace Volo.CmsKit.Admin.Contents
{
[Authorize(CmsKitAdminPermissions.Contents.Default)]
public class ContentAdminAppService :
CrudAppService<
Content,
ContentDto,
ContentGetListDto,
Guid,
ContentGetListInput,
ContentCreateDto,
ContentUpdateDto
>, IContentAdminAppService
{
protected IContentManager ContentManager { get; }
protected IContentRepository ContentRepository { get; }
public ContentAdminAppService(
IRepository<Content, Guid> repository,
IContentManager contentManager,
IContentRepository contentRepository) : base(repository)
{
ContentManager = contentManager;
ContentRepository = contentRepository;
GetListPolicyName = CmsKitAdminPermissions.Contents.Default;
GetPolicyName = CmsKitAdminPermissions.Contents.Default;
CreatePolicyName = CmsKitAdminPermissions.Contents.Create;
UpdatePolicyName = CmsKitAdminPermissions.Contents.Update;
DeletePolicyName = CmsKitAdminPermissions.Contents.Delete;
}
[Authorize(CmsKitAdminPermissions.Contents.Create)]
public override async Task<ContentDto> CreateAsync(ContentCreateDto input)
{
var entity = new Content(
GuidGenerator.Create(),
input.EntityType,
input.EntityId,
input.Value,
CurrentTenant?.Id);
await ContentManager.InsertAsync(entity);
return await MapToGetOutputDtoAsync(entity);
}
public virtual async Task<ContentDto> GetAsync(
[NotNull] string entityType,
[NotNull] string entityId)
{
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
var content = await ContentRepository.GetAsync(entityType, entityId, CurrentTenant?.Id);
return ObjectMapper.Map<Content, ContentDto>(content);
}
}
}

1
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml

@ -2,7 +2,6 @@
@using System.Globalization
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar
@using Volo.CmsKit.Admin.Web.Pages
@using Volo.CmsKit.Admin.Web.Menus

1
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml

@ -5,7 +5,6 @@
@using Volo.CmsKit.Blogs
@using Volo.CmsKit.Admin.Web.Pages
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor
@using Volo.CmsKit.Admin.Web.Menus
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags.Components.TagEditor

44
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs

@ -1,44 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.Uppy;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.ContentEditor
{
[Widget(
StyleTypes = new[]
{
typeof(TuiEditorStyleContributor)
},
ScriptTypes = new[]
{
typeof(TuiEditorScriptContributor),
typeof(UppyScriptContributor)
},
ScriptFiles = new[]
{
"/Pages/CmsKit/Contents/Components/ContentEditor/default.js"
})]
public class ContentEditorViewComponent : AbpViewComponent
{
public async Task<IViewComponentResult> InvokeAsync(string inputId)
{
return View(
"~/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml",
new ContentEditorViewModel(inputId));
}
public class ContentEditorViewModel
{
public ContentEditorViewModel(string inputId)
{
InputId = inputId;
}
public string InputId { get; set; }
}
}
}

7
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml

@ -1,7 +0,0 @@
@using System.Globalization
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.ContentEditor
@model ContentEditorViewComponent.ContentEditorViewModel
<div class="content-editor" id="@Model.InputId-container" data-input-id="@Model.InputId" data-language="@(CultureInfo.CurrentUICulture.TwoLetterISOLanguageName)">
</div>

80
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js

@ -1,80 +0,0 @@
$(function () {
var fileUploadUri = "/api/cms-kit-admin/media";
var fileUriPrefix = "/api/cms-kit/media/";
var editorDataKey = "tuiEditor";
initAllEditors();
function initAllEditors() {
$('.content-editor').each(function (i, item) {
initEditor(item);
});
}
function initEditor(element) {
var $editorContainer = $(element);
var inputName = $editorContainer.data('input-id');
var $editorInput = $('#' + inputName);
var initialValue = $editorInput.val();
var editor = $editorContainer.tuiEditor({
usageStatistics: false,
useCommandShortcut: true,
initialValue: initialValue,
previewStyle: 'tab',
height: "25em",
minHeight: "25em",
initialEditType: initialValue ? 'wysiwyg' : 'markdown',
language: $editorContainer.data("language"),
hooks: {
addImageBlobHook: uploadFile,
},
events: {
change: function (_val) {
$editorInput.val(editor.getHtml());
$editorInput.trigger("change");
}
}
}).data(editorDataKey);
}
function getUppyHeaders() {
var headers = {};
headers[abp.security.antiForgery.tokenHeaderName] = abp.security.antiForgery.getToken();
return headers;
}
function uploadFile(blob, callback, source) {
var UPPY_OPTIONS = {
endpoint: fileUploadUri,
formData: true,
fieldName: "file",
method: "post",
headers: getUppyHeaders()
};
var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS);
UPPY.reset();
UPPY.addFile({
id: "content-file",
name: blob.name,
type: blob.type,
data: blob,
});
UPPY.upload().then((result) => {
if (result.failed.length > 0) {
abp.message.error("File upload failed");
} else {
var mediaDto = result.successful[0].response.body;
var fileUrl = (fileUriPrefix + mediaDto.id);
callback(fileUrl, mediaDto.name);
}
});
}
});

28
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs

@ -1,28 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using System;
namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor
{
public class ContentViewModel
{
public ContentViewModel(string entityType, string entityId, string value = null, Guid? id = null)
{
EntityType = entityType;
EntityId = entityId;
Value = value;
Id = id;
}
[HiddenInput]
public string EntityType { get; set; }
[HiddenInput]
public string EntityId { get; set; }
[HiddenInput]
public string Value { get; set; }
[HiddenInput]
public Guid? Id { get; set; }
}
}

27
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml

@ -1,27 +0,0 @@
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.ContentEditor
@using Volo.CmsKit.Localization
@using Microsoft.Extensions.Localization
@model EntityContentEditorViewComponent.EntityContentEditorViewModel
@inject IStringLocalizer<CmsKitResource> L
@if (Model.DisplaySubmitButton)
{
<abp-dynamic-form abp-model="ViewModel" class="form-entity-content-editor">
<abp-form-content />
<abp-button button-type="Primary" type="submit" text="@L["Submit"]" />
</abp-dynamic-form>
}
else
{
<abp-input asp-for="ViewModel.Id" />
<abp-input asp-for="ViewModel.EntityId" />
<abp-input asp-for="ViewModel.EntityType" />
<abp-input asp-for="ViewModel.Value" />
}
@await Component.InvokeAsync(typeof(ContentEditorViewComponent), new { inputId = Html.IdFor(m => m.ViewModel.Value) })

65
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs

@ -1,65 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
using Volo.Abp.Domain.Entities;
using Volo.CmsKit.Admin.Contents;
namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor
{
[Widget(
ScriptFiles = new[]
{
"/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js"
})]
public class EntityContentEditorViewComponent : AbpViewComponent
{
private readonly IContentAdminAppService contentAdminAppService;
public EntityContentEditorViewComponent(IContentAdminAppService contentAdminAppService)
{
this.contentAdminAppService = contentAdminAppService;
}
public async Task<IViewComponentResult> InvokeAsync(string entityType, string entityId, bool displaySubmitButton = true)
{
var viewModel = new ContentViewModel(entityType, entityId);
try
{
if (entityId != null)
{
var content = await contentAdminAppService.GetAsync(entityType, entityId);
viewModel.Value = content.Value;
viewModel.Id = content.Id;
}
}
catch (EntityNotFoundException)
{
// Initialize editor even content doesn't exist.
}
return View(
"~/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml",
new EntityContentEditorViewModel(viewModel, displaySubmitButton));
}
public class EntityContentEditorViewModel
{
public ContentViewModel ViewModel { get; set; }
public bool DisplaySubmitButton { get; set; }
public EntityContentEditorViewModel(ContentViewModel viewModel, bool displaySubmitButton)
{
ViewModel = viewModel;
DisplaySubmitButton = displaySubmitButton;
}
}
}
}

34
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js

@ -1,34 +0,0 @@
$(function () {
$entityContentEditors = $('.form-entity-content-editor');
var contentAdminService = volo.cmsKit.admin.contents.contentAdmin;
$entityContentEditors.on('submit', function (e, obj) {
e.preventDefault();
var $form = $(e.currentTarget);
if ($form.valid()) {
var data = form.serializeFormToObject().viewModel;
abp.ui.setBusy(e);
if (data.id) {
contentAdminService
.update(data.id, data)
.then(function (result) {
abp.ui.clearBusy();
});
}
else {
contentAdminService
.create(data)
.then(function (result) {
abp.ui.clearBusy();
});
}
}
})
})

2
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml

@ -9,7 +9,7 @@
@inherits CmsKitAdminPageBase
@model CreateModel
@model Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages.CreateModel
@{
PageLayout.Content.Title = L["Pages"].Value;

11
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml

@ -1,12 +1,11 @@
@page "{Id}"
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor
@using Volo.CmsKit.Admin.Web.Menus
@using Volo.CmsKit.Admin.Web.Pages
@inherits CmsKitAdminPageBase
@model UpdateModel
@model Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages.UpdateModel
@{
PageLayout.Content.Title = L["Pages"].Value;
@ -29,14 +28,6 @@
<abp-input asp-for="ViewModel.Slug" title="@L["PageSlugInformation"]" data-toggle="tooltip" />
</abp-dynamic-form>
@await Component.InvokeAsync(typeof(EntityContentEditorViewComponent), new
{
entityType = "Page",
entityId = Model.Id.ToString(),
displaySubmitButton = false
})
</abp-card-body>
<abp-card-footer>
<abp-button button-type="Primary" type="submit" text="@L["Submit"].Value" id="button-page-update" />

44
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs

@ -1,44 +0,0 @@
using System;
using JetBrains.Annotations;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Volo.CmsKit.Contents
{
public class Content : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
[CanBeNull] public virtual Guid? TenantId { get; protected set; }
[NotNull] public virtual string EntityType { get; protected set; }
[NotNull] public virtual string EntityId { get; protected set; }
[NotNull] public virtual string Value { get; protected set; }
protected Content()
{
}
public Content(Guid id, [NotNull] string entityType, [NotNull] string entityId, [NotNull] string value,
Guid? tenantId = null) : base(id)
{
EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength);
EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength);
Value = Check.NotNullOrEmpty(value, nameof(value), ContentConsts.MaxValueLength);
TenantId = tenantId;
}
public virtual void SetValue([NotNull] string value)
{
Value = Check.NotNullOrEmpty(value, nameof(value), ContentConsts.MaxValueLength);
}
public virtual void SetEntity([NotNull] string entityType, [NotNull] string entityId)
{
EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength);
EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength);
}
}
}

17
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentAlreadyExistException.cs

@ -1,17 +0,0 @@
using JetBrains.Annotations;
using System;
using Volo.Abp;
namespace Volo.CmsKit.Contents
{
[Serializable]
public class ContentAlreadyExistException : BusinessException
{
public ContentAlreadyExistException([NotNull] string entityType, [NotNull] string entityId)
{
Code = CmsKitErrorCodes.ContentAlreadyExist;
WithData(nameof(Content.EntityType), entityType);
WithData(nameof(Content.EntityId), entityId);
}
}
}

32
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentManager.cs

@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
using Volo.CmsKit.Contents;
namespace Volo.CmsKit.Contents
{
public class ContentManager : DomainService, IContentManager
{
protected IContentRepository ContentRepository { get; }
public ContentManager(IContentRepository contentRepository)
{
ContentRepository = contentRepository;
}
public virtual async Task<Content> InsertAsync(Content content, CancellationToken cancellationToken = default)
{
if (await ContentRepository.ExistsAsync(content.EntityType, content.EntityId, content.TenantId,
cancellationToken))
{
throw new ContentAlreadyExistException(content.EntityType, content.EntityId);
}
return await ContentRepository.InsertAsync(content, cancellationToken: cancellationToken);
}
}
}

11
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentManager.cs

@ -1,11 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using Volo.CmsKit.Contents;
namespace Volo.CmsKit.Contents
{
public interface IContentManager
{
Task<Content> InsertAsync(Content content, CancellationToken cancellationToken = default);
}
}

35
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentRepository.cs

@ -1,35 +0,0 @@
using JetBrains.Annotations;
using System;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
namespace Volo.CmsKit.Contents
{
public interface IContentRepository : IBasicRepository<Content, Guid>
{
Task<Content> GetAsync(
[NotNull] string entityType,
[NotNull] string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default);
Task<Content> FindAsync(
[NotNull] string entityType,
[NotNull] string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default);
Task DeleteAsync(
[NotNull] string entityType,
[NotNull] string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default);
Task<bool> ExistsAsync(
[NotNull] string entityType,
[NotNull] string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default);
}
}

86
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Contents/EfCoreContentRepository.cs

@ -1,86 +0,0 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using System;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.CmsKit.EntityFrameworkCore;
namespace Volo.CmsKit.Contents
{
public class EfCoreContentRepository : EfCoreRepository<ICmsKitDbContext, Content, Guid>, IContentRepository
{
public EfCoreContentRepository(IDbContextProvider<ICmsKitDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public virtual Task<Content> GetAsync(
string entityType,
string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default)
{
Check.NotNullOrEmpty(entityType, nameof(entityType));
Check.NotNullOrEmpty(entityId, nameof(entityId));
return GetAsync(x =>
x.EntityType == entityType &&
x.EntityId == entityId &&
x.TenantId == tenantId,
cancellationToken: GetCancellationToken(cancellationToken)
);
}
public virtual Task<Content> FindAsync(
string entityType,
string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default)
{
Check.NotNullOrEmpty(entityType, nameof(entityType));
Check.NotNullOrEmpty(entityId, nameof(entityId));
return FindAsync(x =>
x.EntityType == entityType &&
x.EntityId == entityId &&
x.TenantId == tenantId,
cancellationToken: GetCancellationToken(cancellationToken)
);
}
public virtual Task DeleteAsync(
string entityType,
string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default)
{
Check.NotNullOrEmpty(entityType, nameof(entityType));
Check.NotNullOrEmpty(entityId, nameof(entityId));
return DeleteAsync(x =>
x.EntityType == entityType &&
x.EntityId == entityId &&
x.TenantId == tenantId,
cancellationToken: GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> ExistsAsync(
[NotNull] string entityType,
[NotNull] string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default)
{
Check.NotNullOrEmpty(entityType, nameof(entityType));
Check.NotNullOrEmpty(entityId, nameof(entityId));
var dbSet = await GetDbSetAsync();
return await dbSet.AnyAsync(x =>
x.EntityType == entityType &&
x.EntityId == entityId &&
x.TenantId == tenantId,
cancellationToken: GetCancellationToken(cancellationToken));
}
}
}

2
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs

@ -3,7 +3,6 @@ using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.CmsKit.Blogs;
using Volo.CmsKit.Comments;
using Volo.CmsKit.Contents;
using Volo.CmsKit.MediaDescriptors;
using Volo.CmsKit.Pages;
using Volo.CmsKit.Ratings;
@ -16,7 +15,6 @@ namespace Volo.CmsKit.EntityFrameworkCore
[ConnectionStringName(CmsKitDbProperties.ConnectionStringName)]
public class CmsKitDbContext : AbpDbContext<CmsKitDbContext>, ICmsKitDbContext
{
public DbSet<Content> Contents { get; set; }
public DbSet<Comment> Comments { get; set; }
public DbSet<CmsUser> User { get; set; }
public DbSet<UserReaction> Reactions { get; set; }

21
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs

@ -8,7 +8,6 @@ using Volo.CmsKit.Comments;
using Volo.CmsKit.Reactions;
using Volo.CmsKit.Users;
using Volo.Abp.Users.EntityFrameworkCore;
using Volo.CmsKit.Contents;
using Volo.CmsKit.GlobalFeatures;
using Volo.CmsKit.Pages;
using Volo.CmsKit.Ratings;
@ -111,26 +110,6 @@ namespace Volo.CmsKit.EntityFrameworkCore
builder.Ignore<Rating>();
}
if (GlobalFeatureManager.Instance.IsEnabled<ContentsFeature>())
{
builder.Entity<Content>(b =>
{
b.ToTable(options.TablePrefix + "Contents", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.EntityType).IsRequired().HasMaxLength(ContentConsts.MaxEntityTypeLength);
b.Property(x => x.EntityId).IsRequired().HasMaxLength(ContentConsts.MaxEntityIdLength);
b.Property(x => x.Value).IsRequired().HasMaxLength(ContentConsts.MaxValueLength);
b.HasIndex(x => new { x.TenantId, x.EntityType, x.EntityId });
});
}
else
{
builder.Ignore<Content>();
}
if (GlobalFeatureManager.Instance.IsEnabled<TagsFeature>())
{
builder.Entity<Tag>(b =>

1
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs

@ -29,7 +29,6 @@ namespace Volo.CmsKit.EntityFrameworkCore
options.AddRepository<UserReaction, EfCoreUserReactionRepository>();
options.AddRepository<Comment, EfCoreCommentRepository>();
options.AddRepository<Rating, EfCoreRatingRepository>();
options.AddRepository<Content, EfCoreContentRepository>();
options.AddRepository<Tag, EfCoreTagRepository>();
options.AddRepository<EntityTag, EfCoreEntityTagRepository>();
options.AddRepository<Page, EfCorePageRepository>();

2
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs

@ -3,7 +3,6 @@ using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.CmsKit.Blogs;
using Volo.CmsKit.Comments;
using Volo.CmsKit.Contents;
using Volo.CmsKit.MediaDescriptors;
using Volo.CmsKit.Pages;
using Volo.CmsKit.Ratings;
@ -16,7 +15,6 @@ namespace Volo.CmsKit.EntityFrameworkCore
[ConnectionStringName(CmsKitDbProperties.ConnectionStringName)]
public interface ICmsKitDbContext : IEfCoreDbContext
{
DbSet<Content> Contents { get; }
DbSet<Comment> Comments { get; }
DbSet<CmsUser> User { get; }
DbSet<UserReaction> Reactions { get; }

2
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs

@ -24,8 +24,6 @@ namespace Volo.CmsKit.MongoDB
public IMongoCollection<CmsUser> CmsUsers => Collection<CmsUser>();
public IMongoCollection<Rating> Ratings => Collection<Rating>();
public IMongoCollection<Content> Contents => Collection<Content>();
public IMongoCollection<Tag> Tags => Collection<Tag>();

5
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs

@ -47,11 +47,6 @@ namespace Volo.CmsKit.MongoDB
x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Ratings";
});
builder.Entity<Content>(x =>
{
x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Contents";
});
builder.Entity<Tag>(x =>
{
x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Tags";

3
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs

@ -4,11 +4,9 @@ using Volo.Abp.MongoDB;
using Volo.Abp.Users.MongoDB;
using Volo.CmsKit.Blogs;
using Volo.CmsKit.Comments;
using Volo.CmsKit.Contents;
using Volo.CmsKit.MediaDescriptors;
using Volo.CmsKit.MongoDB.Blogs;
using Volo.CmsKit.MongoDB.Comments;
using Volo.CmsKit.MongoDB.Contents;
using Volo.CmsKit.MongoDB.MediaDescriptors;
using Volo.CmsKit.MongoDB.Pages;
using Volo.CmsKit.MongoDB.Ratings;
@ -38,7 +36,6 @@ namespace Volo.CmsKit.MongoDB
options.AddRepository<UserReaction, MongoUserReactionRepository>();
options.AddRepository<Comment, MongoCommentRepository>();
options.AddRepository<Rating, MongoRatingRepository>();
options.AddRepository<Content, MongoContentRepository>();
options.AddRepository<Tag, MongoTagRepository>();
options.AddRepository<EntityTag, MongoEntityTagRepository>();
options.AddRepository<Page, MongoPageRepository>();

80
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs

@ -1,80 +0,0 @@
using JetBrains.Annotations;
using MongoDB.Driver.Linq;
using System;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.MongoDB;
using Volo.CmsKit.Contents;
namespace Volo.CmsKit.MongoDB.Contents
{
public class MongoContentRepository : MongoDbRepository<ICmsKitMongoDbContext, Content, Guid>, IContentRepository
{
public MongoContentRepository(IMongoDbContextProvider<ICmsKitMongoDbContext> dbContextProvider) : base(
dbContextProvider)
{
}
public virtual Task<Content> GetAsync(
string entityType,
string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default)
{
Check.NotNullOrEmpty(entityType, nameof(entityType));
Check.NotNullOrEmpty(entityId, nameof(entityId));
return GetAsync(x =>
x.EntityType == entityType &&
x.EntityId == entityId &&
x.TenantId == tenantId,
cancellationToken: GetCancellationToken(cancellationToken)
);
}
public virtual Task<Content> FindAsync(
string entityType,
string entityId,
Guid? tenantId = null,
CancellationToken cancellationToken = default)
{
Check.NotNullOrEmpty(entityType, nameof(entityType));
Check.NotNullOrEmpty(entityId, nameof(entityId));
return FindAsync(x =>
x.EntityType == entityType &&
x.EntityId == entityId &&
x.TenantId == tenantId,
cancellationToken: GetCancellationToken(cancellationToken)
);
}
public virtual Task DeleteAsync(string entityType, string entityId, Guid? tenantId = null,
CancellationToken cancellationToken = default)
{
Check.NotNullOrEmpty(entityType, nameof(entityType));
Check.NotNullOrEmpty(entityId, nameof(entityId));
return DeleteAsync(x =>
x.EntityType == entityType &&
x.EntityId == entityId &&
x.TenantId == tenantId,
cancellationToken: GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> ExistsAsync([NotNull] string entityType, [NotNull] string entityId,
Guid? tenantId = null, CancellationToken cancellationToken = default)
{
Check.NotNullOrEmpty(entityType, nameof(entityType));
Check.NotNullOrEmpty(entityId, nameof(entityId));
return await (await GetMongoQueryableAsync(cancellationToken)).AnyAsync(x =>
x.EntityType == entityType &&
x.EntityId == entityId &&
x.TenantId == tenantId,
cancellationToken: GetCancellationToken(cancellationToken));
}
}
}

2
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs

@ -25,8 +25,6 @@ namespace Volo.CmsKit.MongoDB
IMongoCollection<Rating> Ratings { get; }
IMongoCollection<Content> Contents { get; }
IMongoCollection<Tag> Tags { get; }
IMongoCollection<EntityTag> EntityTags { get; }

25
modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Contents/ContentPublicAppService.cs

@ -1,25 +0,0 @@
using System.Threading.Tasks;
using Volo.CmsKit.Contents;
namespace Volo.CmsKit.Public.Contents
{
public class ContentPublicAppService : CmsKitPublicAppServiceBase, IContentPublicAppService
{
protected IContentRepository ContentRepository { get; }
public ContentPublicAppService(IContentRepository contentRepository)
{
ContentRepository = contentRepository;
}
public virtual async Task<ContentDto> GetAsync(GetContentInput input)
{
var entity = await ContentRepository.GetAsync(
input.EntityType,
input.EntityId,
CurrentTenant.Id);
return ObjectMapper.Map<Content, ContentDto>(entity);
}
}
}

4
modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs

@ -2,11 +2,9 @@
using Volo.Abp.AutoMapper;
using Volo.CmsKit.Blogs;
using Volo.CmsKit.Comments;
using Volo.CmsKit.Contents;
using Volo.CmsKit.Pages;
using Volo.CmsKit.Public.Blogs;
using Volo.CmsKit.Public.Comments;
using Volo.CmsKit.Public.Contents;
using Volo.CmsKit.Public.Pages;
using Volo.CmsKit.Public.Ratings;
using Volo.CmsKit.Ratings;
@ -29,8 +27,6 @@ namespace Volo.CmsKit.Public
CreateMap<Rating, RatingDto>();
CreateMap<Content, ContentDto>();
CreateMap<Page, PageDto>();
CreateMap<BlogPost, BlogPostPublicDto>(MemberList.None);

142
modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs

@ -1,142 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using NSubstitute;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Users;
using Volo.CmsKit.Admin.Contents;
using Xunit;
namespace Volo.CmsKit.Contents
{
public class ContentAdminAppService_Tests : CmsKitApplicationTestBase
{
private ICurrentUser _currentUser;
private readonly CmsKitTestData _data;
private readonly IContentAdminAppService _service;
public ContentAdminAppService_Tests()
{
_data = GetRequiredService<CmsKitTestData>();
_service = GetRequiredService<IContentAdminAppService>();
}
protected override void AfterAddApplication(IServiceCollection services)
{
_currentUser = Substitute.For<ICurrentUser>();
services.AddSingleton(_currentUser);
}
[Fact]
public async Task ShouldGetListAsync()
{
var result = await _service.GetListAsync(new ContentGetListInput());
result.ShouldNotBeNull();
result.Items.ShouldNotBeEmpty();
result.Items.Count.ShouldBe(4);
result.Items.All(x => x.ShouldBeOfType<ContentGetListDto>() != null);
}
[Fact]
public async Task ShouldGetAsync()
{
var result = await _service.GetAsync(_data.Content_1_Id);
result.ShouldNotBeNull();
result.ShouldBeOfType<Admin.Contents.ContentDto>();
result.ShouldNotBeNull(result.Value);
}
[Fact]
public async Task ShouldCreateAsync()
{
var entityId = "1-2-3";
var entityType = "My.Awesome.Blog";
var value = "Some long content";
var created = await _service.CreateAsync(new ContentCreateDto
{
EntityId = entityId,
EntityType = entityType,
Value = value
});
created.Id.ShouldNotBe(Guid.Empty);
var content = await _service.GetAsync(created.Id);
content.ShouldNotBeNull();
content.EntityType.ShouldBe(entityType);
}
[Fact]
public async Task ShouldNotCreateWithSameParametersAsync()
{
var entityTtype = "My.Awesome.Book";
var entityId = "1";
await _service.CreateAsync(new ContentCreateDto
{
EntityId = entityId,
EntityType = entityTtype,
Value = "Some long content"
});
await Should.ThrowAsync<ContentAlreadyExistException>(async () =>
await _service.CreateAsync(new ContentCreateDto
{
EntityId = entityId,
EntityType = entityTtype,
Value = "Yet another long content"
})
);
}
[Fact]
public async Task ShouldUpdateAsync()
{
string newValue = "Newly created fresh value";
var updateDto = new ContentUpdateDto
{
Value = newValue
};
await _service.UpdateAsync(_data.Content_1_Id, updateDto);
var content = await _service.GetAsync(_data.Content_1_Id);
content.ShouldNotBeNull();
content.Value.ShouldBe(newValue);
}
[Fact]
public async Task ShouldDeleteAsync()
{
await _service.DeleteAsync(_data.Content_2_Id);
await Should.ThrowAsync<EntityNotFoundException>(async () => await _service.GetAsync(_data.Content_2_Id));
}
[Fact]
public async Task ShouldNotThrowEntityNotFoundExceptionWhileDeletingAlreadyDeletedAsync()
{
await _service.DeleteAsync(_data.Content_2_Id);
await Should.NotThrowAsync(async () =>
await _service.DeleteAsync(_data.Content_2_Id));
}
[Fact]
public async Task ShouldGetByEntityAsync()
{
var entity = await _service.GetAsync(_data.Content_1_EntityType, _data.Content_1_EntityId);
entity.ShouldNotBeNull();
entity.EntityId.ShouldBe(_data.Content_1_EntityId);
entity.EntityType.ShouldBe(_data.Content_1_EntityType);
}
}
}

9
modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Contents/ContentRepository_Test.cs

@ -1,9 +0,0 @@
using Volo.CmsKit.Contents;
namespace Volo.CmsKit.EntityFrameworkCore.Contents
{
public class ContentRepository_Test : ContentRepository_Tests<CmsKitEntityFrameworkCoreTestModule>
{
}
}

11
modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Contents/ContentRepository_Test.cs

@ -1,11 +0,0 @@
using Volo.CmsKit.Contents;
using Xunit;
namespace Volo.CmsKit.MongoDB.Contents
{
[Collection(MongoTestCollection.Name)]
public class ContentRepository_Test : ContentRepository_Tests<CmsKitMongoDbTestModule>
{
}
}

39
modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs

@ -2,19 +2,16 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.BlobStoring;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Users;
using Volo.CmsKit.Blogs;
using Volo.CmsKit.Comments;
using Volo.CmsKit.Contents;
using Volo.CmsKit.MediaDescriptors;
using Volo.CmsKit.Pages;
using Volo.CmsKit.Ratings;
@ -33,7 +30,6 @@ namespace Volo.CmsKit
private readonly ReactionManager _reactionManager;
private readonly IRatingRepository _ratingRepository;
private readonly ICurrentTenant _currentTenant;
private readonly IContentRepository _contentRepository;
private readonly EntityTagManager _entityTagManager;
private readonly TagManager _tagManager;
private readonly ITagRepository _tagRepository;
@ -57,7 +53,6 @@ namespace Volo.CmsKit
ReactionManager reactionManager,
IRatingRepository ratingRepository,
ICurrentTenant currentTenant,
IContentRepository contentRepository,
TagManager tagManager,
ITagRepository tagRepository,
IEntityTagRepository entityTagRepository,
@ -80,7 +75,6 @@ namespace Volo.CmsKit
_reactionManager = reactionManager;
_ratingRepository = ratingRepository;
_currentTenant = currentTenant;
_contentRepository = contentRepository;
_tagManager = tagManager;
_tagRepository = tagRepository;
_entityTagManager = entityTagManager;
@ -111,8 +105,6 @@ namespace Volo.CmsKit
await SeedRatingsAsync();
await SeedContentsAsync();
await SeedTagsAsync();
await SeedPagesAsync();
@ -264,37 +256,6 @@ namespace Volo.CmsKit
));
}
private async Task SeedContentsAsync()
{
var content1 = new Content(
_cmsKitTestData.Content_1_Id,
_cmsKitTestData.Content_1_EntityType,
_cmsKitTestData.Content_1_EntityId,
_cmsKitTestData.Content_1
);
var content2 = new Content(
_cmsKitTestData.Content_2_Id,
_cmsKitTestData.Content_2_EntityType,
_cmsKitTestData.Content_2_EntityId,
_cmsKitTestData.Content_2
);
var content3 = new Content(
Guid.NewGuid(),
"deleted_entity_type",
"deleted_entity_id",
"Content"
)
{
IsDeleted = true,
};
await _contentRepository.InsertAsync(content1);
await _contentRepository.InsertAsync(content2);
await _contentRepository.InsertAsync(content3);
}
private async Task SeedTagsAsync()
{
var created1 = await _tagRepository.InsertAsync(

63
modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs

@ -1,63 +0,0 @@
using System;
using System.Threading.Tasks;
using Shouldly;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Modularity;
using Xunit;
namespace Volo.CmsKit.Contents
{
public abstract class ContentRepository_Tests<TStartupModule> : CmsKitTestBase<TStartupModule>
where TStartupModule : IAbpModule
{
private readonly CmsKitTestData _cmsKitTestData;
private readonly IContentRepository _contentRepository;
protected ContentRepository_Tests()
{
_cmsKitTestData = GetRequiredService<CmsKitTestData>();
_contentRepository = GetRequiredService<IContentRepository>();
}
[Theory]
[InlineData("Lyrics", "1", "First things first")]
[InlineData("LyricsAlso", "2", "Second thing second")]
public async Task ShouldGetAsync(string entityType, string entityId, string contentStartsWith = null)
{
var content = await _contentRepository.GetAsync(entityType, entityId);
content.ShouldNotBeNull();
if (contentStartsWith != null)
{
content.Value.ShouldStartWith(contentStartsWith);
}
}
[Fact]
public async Task ShouldNotGetAsync()
{
Should.Throw<EntityNotFoundException>(
async ()
=>
await _contentRepository.GetAsync("not_exist_entity", Guid.NewGuid().ToString()));
}
[Fact]
public async Task ShouldFindAsync()
{
var content =
await _contentRepository.FindAsync(_cmsKitTestData.Content_1_EntityType, _cmsKitTestData.Content_1_EntityId);
content.ShouldNotBeNull();
}
[Fact]
public async Task ShouldNotFindAsync()
{
var content = await _contentRepository.FindAsync("not_exist_entity", Guid.NewGuid().ToString());
content.ShouldBeNull();
}
}
}
Loading…
Cancel
Save