mirror of https://github.com/abpframework/abp.git
9 changed files with 168 additions and 35 deletions
@ -0,0 +1,55 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Shouldly; |
||||
|
using Volo.Docs.Admin.Documents; |
||||
|
using Volo.Docs.Documents; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Docs |
||||
|
{ |
||||
|
public class DocumentAdminAppService_Tests : DocsAdminApplicationTestBase |
||||
|
{ |
||||
|
private readonly IDocumentAdminAppService _documentAdminAppService; |
||||
|
private readonly IDocumentRepository _documentRepository; |
||||
|
private readonly DocsTestData _testData; |
||||
|
|
||||
|
public DocumentAdminAppService_Tests() |
||||
|
{ |
||||
|
_documentAdminAppService = GetRequiredService<IDocumentAdminAppService>(); |
||||
|
_documentRepository = GetRequiredService<IDocumentRepository>(); |
||||
|
_testData = GetRequiredService<DocsTestData>(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task PullAsync() |
||||
|
{ |
||||
|
(await _documentRepository.FindAsync(_testData.PorjectId, "Part-I.md", "en", "1.0.0")).ShouldBeNull(); |
||||
|
|
||||
|
await _documentAdminAppService.PullAsync(new PullDocumentInput |
||||
|
{ |
||||
|
ProjectId = _testData.PorjectId, |
||||
|
Name = "Part-I.md", |
||||
|
LanguageCode = "en", |
||||
|
Version = "1.0.0" |
||||
|
}); |
||||
|
|
||||
|
(await _documentRepository.FindAsync(_testData.PorjectId, "Part-I.md", "en", "1.0.0")).ShouldNotBeNull(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task PullAllAsync() |
||||
|
{ |
||||
|
(await _documentRepository.FindAsync(_testData.PorjectId, "Part-I.md", "en", "1.0.0")).ShouldBeNull(); |
||||
|
(await _documentRepository.FindAsync(_testData.PorjectId, "Part-II.md", "en", "1.0.0")).ShouldBeNull(); |
||||
|
|
||||
|
await _documentAdminAppService.PullAllAsync(new PullAllDocumentInput |
||||
|
{ |
||||
|
ProjectId = _testData.PorjectId, |
||||
|
LanguageCode = "en", |
||||
|
Version = "1.0.0" |
||||
|
}); |
||||
|
|
||||
|
(await _documentRepository.FindAsync(_testData.PorjectId, "Part-I.md", "en", "1.0.0")).ShouldNotBeNull(); |
||||
|
(await _documentRepository.FindAsync(_testData.PorjectId, "Part-II.md", "en", "1.0.0")).ShouldNotBeNull(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
using Shouldly; |
||||
|
using Volo.Docs.Documents; |
||||
|
using Volo.Docs.FileSystem.Documents; |
||||
|
using Volo.Docs.GitHub.Documents; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Docs |
||||
|
{ |
||||
|
public class DocumentSourceFactory_Tests : DocsDomainTestBase |
||||
|
{ |
||||
|
private readonly IDocumentSourceFactory _documentSourceFactory; |
||||
|
|
||||
|
public DocumentSourceFactory_Tests() |
||||
|
{ |
||||
|
_documentSourceFactory = GetRequiredService<IDocumentSourceFactory>(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public void Create() |
||||
|
{ |
||||
|
_documentSourceFactory.Create(GithubDocumentSource.Type).GetType().ShouldBe(typeof(GithubDocumentSource)); |
||||
|
_documentSourceFactory.Create(FileSystemDocumentSource.Type).GetType().ShouldBe(typeof(FileSystemDocumentSource)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,25 +0,0 @@ |
|||||
using Shouldly; |
|
||||
using Volo.Docs.Documents; |
|
||||
using Volo.Docs.FileSystem.Documents; |
|
||||
using Volo.Docs.GitHub.Documents; |
|
||||
using Xunit; |
|
||||
|
|
||||
namespace Volo.Docs |
|
||||
{ |
|
||||
public class DocumentStoreFactory_Tests : DocsDomainTestBase |
|
||||
{ |
|
||||
private readonly IDocumentSourceFactory _documentStoreFactory; |
|
||||
|
|
||||
public DocumentStoreFactory_Tests() |
|
||||
{ |
|
||||
_documentStoreFactory = GetRequiredService<IDocumentSourceFactory>(); |
|
||||
} |
|
||||
|
|
||||
[Fact] |
|
||||
public void Create() |
|
||||
{ |
|
||||
_documentStoreFactory.Create(GithubDocumentSource.Type).GetType().ShouldBe(typeof(GithubDocumentSource)); |
|
||||
_documentStoreFactory.Create(FileSystemDocumentSource.Type).GetType().ShouldBe(typeof(FileSystemDocumentSource)); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,6 @@ |
|||||
|
namespace Volo.Docs.EntityFrameworkCore |
||||
|
{ |
||||
|
public class DocumentRepository_Tests : DocumentRepository_Tests<DocsEntityFrameworkCoreTestModule> |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using Volo.Docs.MongoDB; |
||||
|
|
||||
|
namespace Volo.Docs.Document |
||||
|
{ |
||||
|
public class DocumentRepository_Tests : DocumentRepository_Tests<DocsMongoDBTestModule> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Shouldly; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Docs.Documents; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Docs |
||||
|
{ |
||||
|
public abstract class DocumentRepository_Tests<TStartupModule> : DocsTestBase<TStartupModule> |
||||
|
where TStartupModule : IAbpModule |
||||
|
{ |
||||
|
protected readonly IDocumentRepository DocumentRepository; |
||||
|
protected readonly DocsTestData DocsTestData; |
||||
|
|
||||
|
protected DocumentRepository_Tests() |
||||
|
{ |
||||
|
DocumentRepository = GetRequiredService<IDocumentRepository>(); |
||||
|
DocsTestData = GetRequiredService<DocsTestData>(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task FindAsync() |
||||
|
{ |
||||
|
var document = await DocumentRepository.FindAsync(DocsTestData.PorjectId, "CLI.md", "en", "2.0.0"); |
||||
|
document.ShouldNotBeNull(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue