From b28ad6b82e23be39401c65f158c1f1fa70251e00 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 11 Jan 2021 15:18:50 +0300 Subject: [PATCH] CmsKit - Fix EntityTag Tests --- .../Tags/EntityTagManager_Tests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/EntityTagManager_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/EntityTagManager_Tests.cs index 2e0d17fadd..5a6144733c 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/EntityTagManager_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/EntityTagManager_Tests.cs @@ -1,6 +1,7 @@ using Shouldly; using System.Linq; using System.Threading.Tasks; +using Volo.Abp.Guids; using Xunit; namespace Volo.CmsKit.Tags @@ -10,18 +11,22 @@ namespace Volo.CmsKit.Tags private readonly CmsKitTestData _cmsKitTestData; private readonly IEntityTagManager _entityTagManager; private readonly ITagRepository _tagRepository; + private readonly IGuidGenerator _guidGenerator; public EntityTagManager_Tests() { _cmsKitTestData = GetRequiredService(); _entityTagManager = GetRequiredService(); _tagRepository = GetRequiredService(); + _guidGenerator = GetRequiredService(); } [Fact] public async Task AddTagToEntityAsync_ShouldAdd_WhenEverythingCorrect() { - var entityTag = await _entityTagManager.AddTagToEntityAsync(_cmsKitTestData.TagId_1, _cmsKitTestData.EntityType1, _cmsKitTestData.EntityId1); + var tag = await _tagRepository.InsertAsync(new Tag(_guidGenerator.Create(), _cmsKitTestData.EntityType1, "My Test Tag #1")); + + var entityTag = await _entityTagManager.AddTagToEntityAsync(tag.Id, _cmsKitTestData.EntityType1, _cmsKitTestData.EntityId1); entityTag.ShouldNotBeNull(); }