mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-12-27 06:35:39 +08:00
1 增加UnitWork
2 修改UnitTest项目为C# 6.0
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>6</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -61,7 +62,9 @@
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
@@ -72,6 +75,7 @@
|
||||
<Compile Include="TestModuleApp.cs" />
|
||||
<Compile Include="TestRepository.cs" />
|
||||
<Compile Include="TestRoleApp.cs" />
|
||||
<Compile Include="TestUnitWork.cs" />
|
||||
<Compile Include="TestUserApp.cs" />
|
||||
<Compile Include="TestOrgApp.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
38
OpenAuth.UnitTest/TestUnitWork.cs
Normal file
38
OpenAuth.UnitTest/TestUnitWork.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
using OpenAuth.Repository;
|
||||
|
||||
namespace OpenAuth.UnitTest
|
||||
{
|
||||
/// <summary>
|
||||
/// TestUnitWork 的摘要说明
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class TestUnitWork
|
||||
{
|
||||
IUnitWork _unit = new UnitWork();
|
||||
/// <summary>
|
||||
/// 测试UnitWork用于联表查询
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void GetDynamic()
|
||||
{
|
||||
var usersInOrg = from user in _unit.Find<User>(null)
|
||||
join relevance in _unit.Find<Relevance>(u => u.Key == "UserOrg") on user.Id equals relevance.FirstId
|
||||
join org in _unit.Find<Org>(null) on relevance.SecondId equals org.Id
|
||||
select new
|
||||
{
|
||||
user.Name,
|
||||
OrgName = org.Name
|
||||
};
|
||||
|
||||
foreach (var user in usersInOrg)
|
||||
{
|
||||
Debug.WriteLine($"{user.Name} :{user.OrgName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user