mirror of https://github.com/abpframework/abp.git
22 changed files with 68 additions and 115 deletions
@ -1,10 +0,0 @@ |
|||||
using MyCompanyName.MyProjectName.EntityFrameworkCore; |
|
||||
using Xunit; |
|
||||
|
|
||||
namespace MyCompanyName.MyProjectName; |
|
||||
|
|
||||
[CollectionDefinition(MyProjectNameTestConsts.CollectionDefinitionName)] |
|
||||
public class MyProjectNameApplicationCollection : MyProjectNameEntityFrameworkCoreCollectionFixtureBase |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
@ -1,10 +0,0 @@ |
|||||
using MyCompanyName.MyProjectName.EntityFrameworkCore; |
|
||||
using Xunit; |
|
||||
|
|
||||
namespace MyCompanyName.MyProjectName; |
|
||||
|
|
||||
[CollectionDefinition(MyProjectNameTestConsts.CollectionDefinitionName)] |
|
||||
public class MyProjectNameDomainCollection : MyProjectNameEntityFrameworkCoreCollectionFixtureBase |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
@ -0,0 +1,10 @@ |
|||||
|
using MyCompanyName.MyProjectName.Samples; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace MyCompanyName.MyProjectName.EntityFrameworkCore.Applications; |
||||
|
|
||||
|
[Collection(MyProjectNameTestConsts.CollectionDefinitionName)] |
||||
|
public class EfCoreSampleAppServiceTests : SampleAppServiceTests<MyProjectNameEntityFrameworkCoreTestModule> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using MyCompanyName.MyProjectName.Samples; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace MyCompanyName.MyProjectName.EntityFrameworkCore.Domains; |
||||
|
|
||||
|
[Collection(MyProjectNameTestConsts.CollectionDefinitionName)] |
||||
|
public class EfCoreSampleDomainTests : SampleDomainTests<MyProjectNameEntityFrameworkCoreTestModule> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using MyCompanyName.MyProjectName.MongoDB; |
||||
|
using MyCompanyName.MyProjectName.Samples; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace MyCompanyName.MyProjectName.MongoDb.Applications; |
||||
|
|
||||
|
[Collection(MyProjectNameTestConsts.CollectionDefinitionName)] |
||||
|
public class MongoDBSampleAppServiceTests : SampleAppServiceTests<MyProjectNameMongoDbTestModule> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using MyCompanyName.MyProjectName.Samples; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace MyCompanyName.MyProjectName.MongoDB.Domains; |
||||
|
|
||||
|
[Collection(MyProjectNameTestConsts.CollectionDefinitionName)] |
||||
|
public class MongoDBSampleDomainTests : SampleDomainTests<MyProjectNameMongoDbTestModule> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
@ -1,10 +0,0 @@ |
|||||
using MyCompanyName.MyProjectName.EntityFrameworkCore; |
|
||||
using Xunit; |
|
||||
|
|
||||
namespace MyCompanyName.MyProjectName; |
|
||||
|
|
||||
[CollectionDefinition(MyProjectNameTestConsts.CollectionDefinitionName)] |
|
||||
public class MyProjectNameWebCollection : MyProjectNameEntityFrameworkCoreCollectionFixtureBase |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
@ -1,59 +0,0 @@ |
|||||
using System; |
|
||||
using System.IO; |
|
||||
using System.Linq; |
|
||||
|
|
||||
namespace MyCompanyName.MyProjectName; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// This class is used to find root path of the web project. Used for;
|
|
||||
/// 1. unit tests (to find views).
|
|
||||
/// 2. entity framework core command line commands (to find the conn string).
|
|
||||
/// </summary>
|
|
||||
public static class WebContentDirectoryFinder |
|
||||
{ |
|
||||
public static string? CalculateContentRootFolder() |
|
||||
{ |
|
||||
var domainAssemblyDirectoryPath = |
|
||||
Path.GetDirectoryName(typeof(MyProjectNameDomainModule).Assembly.Location); |
|
||||
if (domainAssemblyDirectoryPath == null) |
|
||||
{ |
|
||||
throw new Exception( |
|
||||
$"Could not find location of {typeof(MyProjectNameDomainModule).Assembly.FullName} assembly!"); |
|
||||
} |
|
||||
|
|
||||
var directoryInfo = new DirectoryInfo(domainAssemblyDirectoryPath); |
|
||||
|
|
||||
if (Environment.GetEnvironmentVariable("NCrunch") == "1") |
|
||||
{ |
|
||||
while (!DirectoryContains(directoryInfo.FullName, "MyCompanyName.MyProjectName.Web.csproj", SearchOption.AllDirectories)) |
|
||||
{ |
|
||||
directoryInfo = directoryInfo.Parent ?? throw new Exception("Could not find content root folder!"); |
|
||||
} |
|
||||
|
|
||||
var webProject = Directory.GetFiles(directoryInfo.FullName, string.Empty, SearchOption.AllDirectories) |
|
||||
.First(filePath => string.Equals(Path.GetFileName(filePath), "MyCompanyName.MyProjectName.Web.csproj")); |
|
||||
|
|
||||
return Path.GetDirectoryName(webProject); |
|
||||
} |
|
||||
|
|
||||
while (!DirectoryContains(directoryInfo.FullName, "MyCompanyName.MyProjectName.sln")) |
|
||||
{ |
|
||||
directoryInfo = directoryInfo.Parent ?? throw new Exception("Could not find content root folder!"); |
|
||||
} |
|
||||
|
|
||||
var webFolder = Path.Combine(directoryInfo.FullName, $"src{Path.DirectorySeparatorChar}MyCompanyName.MyProjectName.Web"); |
|
||||
if (Directory.Exists(webFolder)) |
|
||||
{ |
|
||||
return webFolder; |
|
||||
} |
|
||||
|
|
||||
throw new Exception("Could not find root folder of the web project!"); |
|
||||
} |
|
||||
|
|
||||
private static bool DirectoryContains(string directory, string fileName, |
|
||||
SearchOption searchOption = SearchOption.TopDirectoryOnly) |
|
||||
{ |
|
||||
return Directory.GetFiles(directory, string.Empty, searchOption) |
|
||||
.Any(filePath => string.Equals(Path.GetFileName(filePath), fileName)); |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue