فهرست منبع

单元测试模块化提交

Murphy 3 سال پیش
والد
کامیت
c88889afdf
59فایلهای تغییر یافته به همراه747 افزوده شده و 959 حذف شده
  1. 27 0
      MicroServices/Business/Buissness.UnitTest/Buissness.TestBase.csproj
  2. 0 20
      MicroServices/Business/Buissness.UnitTest/Buissness.UnitTest.csproj
  3. 60 0
      MicroServices/Business/Buissness.UnitTest/CoreTestBase.cs
  4. 65 0
      MicroServices/Business/Buissness.UnitTest/CoreTestBaseModule.cs
  5. 123 0
      MicroServices/Business/Buissness.UnitTest/CoreTestDataSeedContributor.cs
  6. 0 56
      MicroServices/Business/Buissness.UnitTest/InitialData/UnitTestInitialDataBuilder.cs
  7. 32 0
      MicroServices/Business/Buissness.UnitTest/MES/IC/sim_issue_typeRepository_Tests.cs
  8. 0 31
      MicroServices/Business/Buissness.UnitTest/ResourceExamineManagement/ProductExamineAppServiceTest.cs
  9. 43 0
      MicroServices/Business/Buissness.UnitTest/Security/FakeCurrentPrincipalAccessor.cs
  10. 0 59
      MicroServices/Business/Buissness.UnitTest/UnitTestBase.cs
  11. 0 20
      MicroServices/Business/Buissness.UnitTest/UnitTestModule.cs
  12. 0 30
      MicroServices/Business/Business.Application.Contracts/BookManagement/Dto/BookDto.cs
  13. 0 31
      MicroServices/Business/Business.Application.Contracts/BookManagement/Dto/CreateOrUpdateBookDto.cs
  14. 0 10
      MicroServices/Business/Business.Application.Contracts/BookManagement/Dto/GetBookInputDto.cs
  15. 0 17
      MicroServices/Business/Business.Application.Contracts/BookManagement/IBookAppService.cs
  16. 0 5
      MicroServices/Business/Business.Application.Contracts/Permissions/BusinessPermissionDefinitionProvider.cs
  17. 0 8
      MicroServices/Business/Business.Application.Contracts/Permissions/BusinessPermissions.cs
  18. 0 72
      MicroServices/Business/Business.Application.Contracts/PrintTemplateManagement/Dto/CreateOrUpdatePrintTemplateDto.cs
  19. 0 12
      MicroServices/Business/Business.Application.Contracts/PrintTemplateManagement/Dto/GetPrintTemplateInputDto.cs
  20. 0 72
      MicroServices/Business/Business.Application.Contracts/PrintTemplateManagement/Dto/PrintTemplateDto.cs
  21. 0 22
      MicroServices/Business/Business.Application.Contracts/PrintTemplateManagement/IPrintTemplateAppService.cs
  22. 0 2
      MicroServices/Business/Business.Application.Contracts/ResourceExamineManagement/Dto/BomDto.cs
  23. 18 0
      MicroServices/Business/Business.Application.Test/Business.Application.Test.csproj
  24. 11 0
      MicroServices/Business/Business.Application.Test/UnitTest1.cs
  25. 1 0
      MicroServices/Business/Business.Application.Test/Usings.cs
  26. 0 82
      MicroServices/Business/Business.Application/BookManagement/BookAppService.cs
  27. 0 15
      MicroServices/Business/Business.Application/BookManagement/BookAutoMapperProfile.cs
  28. 0 2
      MicroServices/Business/Business.Application/Business.Application.csproj
  29. 0 3
      MicroServices/Business/Business.Application/BusinessApplicationModule.cs
  30. 0 96
      MicroServices/Business/Business.Application/PrintTemplateManagement/PrintTemplateAppService.cs
  31. 0 15
      MicroServices/Business/Business.Application/PrintTemplateManagement/PrintTemplateAutoMapperProfile.cs
  32. 0 11
      MicroServices/Business/Business.Application/ResourceExamineManagement/MorderAppService.cs
  33. 1 1
      MicroServices/Business/Business.Core/Business.Core.csproj
  34. 5 3
      MicroServices/Business/Business.Domain/Business.Domain.csproj
  35. 17 0
      MicroServices/Business/Business.Domain/Isim_issue_typeRepository.cs
  36. 0 33
      MicroServices/Business/Business.Domain/Models/Book.cs
  37. 0 76
      MicroServices/Business/Business.Domain/Models/PrintTemplate.cs
  38. 2 3
      MicroServices/Business/Business.EntityFrameworkCore/Business.EntityFrameworkCore.csproj
  39. 5 10
      MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/BusinessDbContext.cs
  40. 0 21
      MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/BusinessDbContextModelCreatingExtensions.cs
  41. 1 4
      MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/BusinessEntityFrameworkCoreModule.cs
  42. 1 1
      MicroServices/Business/Business.Host/Business.Host.csproj
  43. 2 3
      MicroServices/Business/Business.Host/EntityFrameworkCore/BusinessMigrationDbContext.cs
  44. 0 0
      MicroServices/Business/Business.Host/tempkey.jwk
  45. 0 52
      MicroServices/Business/Business.HttpApi/Controllers/BookController.cs
  46. 0 60
      MicroServices/Business/Business.HttpApi/Controllers/PrintTemplateController.cs
  47. 23 1
      MicroServices/Business/Business.sln
  48. 25 0
      MicroServices/Business/Bussiness.ApplicationTest/Bussiness.ApplicationTest.csproj
  49. 25 0
      MicroServices/Business/Bussiness.ApplicationTest/CoreApplicationTestBase.cs
  50. 21 0
      MicroServices/Business/Bussiness.ApplicationTest/CoreApplicationTestModule.cs
  51. 30 0
      MicroServices/Business/Bussiness.ApplicationTest/ResourceExamineManagement/ResourceExamineAppService_Tests.cs
  52. 28 0
      MicroServices/Business/Bussiness.Domain.Test/Bussiness.Domain.Test.csproj
  53. 9 0
      MicroServices/Business/Bussiness.Domain.Test/CoreDomainTestBase.cs
  54. 15 0
      MicroServices/Business/Bussiness.Domain.Test/CoreDomainTestModule.cs
  55. 25 0
      MicroServices/Business/Bussiness.Domain.Test/MES/IC/ic_substitute_Tests.cs
  56. 10 0
      MicroServices/Business/Bussiness.EntityFrameworkCore.Test/EntityFrameworkCore/CoreEntityFrameworkCoreTestBase.cs
  57. 64 0
      MicroServices/Business/Bussiness.EntityFrameworkCore.Test/EntityFrameworkCore/CoreEntityFrameworkCoreTestModule.cs
  58. 13 0
      MicroServices/Business/Bussiness.EntityFrameworkCore.Test/EntityFrameworkCore/MES/IC/sim_issue_typeRepository_Tests.cs
  59. 45 0
      MicroServices/Business/Bussiness.EntityFrameworkCore.Test/EntityFrameworkCore/Samples/SampleRepositoryTests.cs

+ 27 - 0
MicroServices/Business/Buissness.UnitTest/Buissness.TestBase.csproj

@@ -0,0 +1,27 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
+    <PackageReference Include="NSubstitute" Version="4.2.2" />
+    <PackageReference Include="Shouldly" Version="4.1.0" />
+    <PackageReference Include="Volo.Abp.Authorization" Version="4.4.0" />
+    <PackageReference Include="Volo.Abp.Autofac" Version="7.1.0-rc.2" />
+    <PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="7.1.0-rc.2" />
+    <PackageReference Include="Volo.Abp.Identity.Domain" Version="4.4.0" />
+    <PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="4.4.0" />
+    <PackageReference Include="Volo.Abp.TestBase" Version="4.4.0" />
+    <PackageReference Include="xunit.extensibility.core" Version="2.4.2" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Business.Domain\Business.Domain.csproj" />
+    <ProjectReference Include="..\Bussiness.Model\Bussiness.Model.csproj" />
+  </ItemGroup>
+
+</Project>

+ 0 - 20
MicroServices/Business/Buissness.UnitTest/Buissness.UnitTest.csproj

@@ -1,20 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>net6.0</TargetFramework>
-    <ImplicitUsings>enable</ImplicitUsings>
-    <Nullable>enable</Nullable>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Abp.TestBase" Version="8.1.0" />
-    <PackageReference Include="Effort.EF6" Version="2.2.16" />
-    <PackageReference Include="xunit.extensibility.core" Version="2.4.2" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="..\Business.Application\Business.Application.csproj" />
-    <ProjectReference Include="..\Business.EntityFrameworkCore\Business.EntityFrameworkCore.csproj" />
-  </ItemGroup>
-
-</Project>

+ 60 - 0
MicroServices/Business/Buissness.UnitTest/CoreTestBase.cs

@@ -0,0 +1,60 @@
+using Microsoft.Extensions.DependencyInjection;
+using System.Data.Common;
+using Volo.Abp;
+using Volo.Abp.Modularity;
+using Volo.Abp.Testing;
+using Volo.Abp.Uow;
+
+namespace Buissness.TestBase
+{
+    /* All test classes are derived from this class, directly or indirectly.
+     */
+    public abstract class CoreTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule>
+        where TStartupModule : IAbpModule
+    {
+        protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
+        {
+            options.UseAutofac();
+        }
+
+        protected virtual Task WithUnitOfWorkAsync(Func<Task> func)
+        {
+            return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func);
+        }
+
+        protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func<Task> action)
+        {
+            using (var scope = ServiceProvider.CreateScope())
+            {
+                var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>();
+
+                using (var uow = uowManager.Begin(options))
+                {
+                    await action();
+
+                    await uow.CompleteAsync();
+                }
+            }
+        }
+
+        protected virtual Task<TResult> WithUnitOfWorkAsync<TResult>(Func<Task<TResult>> func)
+        {
+            return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func);
+        }
+
+        protected virtual async Task<TResult> WithUnitOfWorkAsync<TResult>(AbpUnitOfWorkOptions options, Func<Task<TResult>> func)
+        {
+            using (var scope = ServiceProvider.CreateScope())
+            {
+                var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>();
+
+                using (var uow = uowManager.Begin(options))
+                {
+                    var result = await func();
+                    await uow.CompleteAsync();
+                    return result;
+                }
+            }
+        }
+    }
+}

+ 65 - 0
MicroServices/Business/Buissness.UnitTest/CoreTestBaseModule.cs

@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Authorization;
+using Volo.Abp;
+using Volo.Abp.Modularity;
+using Volo.Abp.Autofac;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Threading;
+using Volo.Abp.Data;
+using Volo.Abp.BackgroundJobs;
+using Volo.Abp.IdentityServer;
+
+namespace Buissness.TestBase
+{
+    [DependsOn(
+        typeof(AbpAutofacModule),
+        typeof(AbpTestBaseModule)
+     )]
+    public class CoreTestBaseModule : AbpModule
+    {
+        public override void PreConfigureServices(ServiceConfigurationContext context)
+        {
+            PreConfigure<AbpIdentityServerBuilderOptions>(options =>
+            {
+                options.AddDeveloperSigningCredential = false;
+            });
+
+            PreConfigure<IIdentityServerBuilder>(identityServerBuilder =>
+            {
+                identityServerBuilder.AddDeveloperSigningCredential(false, System.Guid.NewGuid().ToString());
+            });
+        }
+
+        public override void ConfigureServices(ServiceConfigurationContext context)
+        {
+            Configure<AbpBackgroundJobOptions>(options =>
+            {
+                options.IsJobExecutionEnabled = false;
+            });
+
+            context.Services.AddAlwaysAllowAuthorization();
+        }
+
+        public override void OnApplicationInitialization(ApplicationInitializationContext context)
+        {
+            SeedTestData(context);
+        }
+
+        private static void SeedTestData(ApplicationInitializationContext context)
+        {
+            AsyncHelper.RunSync(async () =>
+            {
+                using (var scope = context.ServiceProvider.CreateScope())
+                {
+                    await scope.ServiceProvider
+                        .GetRequiredService<IDataSeeder>()
+                        .SeedAsync();
+                }
+            });
+        }
+    }
+}

+ 123 - 0
MicroServices/Business/Buissness.UnitTest/CoreTestDataSeedContributor.cs

@@ -0,0 +1,123 @@
+
+using Bussiness.Model.MES.IC;
+using Bussiness.Model.Production;
+using Bussiness.Model.Sale;
+using Bussiness.Model.SRM;
+using Bussiness.Model.Tech;
+using Microsoft.Extensions.Hosting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Data;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.MultiTenancy;
+
+namespace Buissness.TestBase
+{
+    public class CoreTestDataSeedContributor : IDataSeedContributor, ITransientDependency
+    {
+        private readonly IRepository<ic_item, long> _mysql_ic_item;
+        private readonly IRepository<ic_bom, long> _mysql_ic_bom;
+        private readonly IRepository<ic_bom_child, long> _mysql_ic_bom_child;
+        private readonly IRepository<mes_technique, long> _mysql_mes_technique;
+        private readonly IRepository<crm_seorder, long> _mysql_crm_seorder;
+        private readonly IRepository<crm_seorderentry, long> _mysql_crm_seorderentry;
+        private readonly IRepository<ic_item_stock, long> _mysql_ic_item_stock;
+        private readonly IRepository<ic_factory_details, long> _mysql_ic_factory_details;
+        private readonly IRepository<mes_oorder, long> _mysql_mes_oorder;
+        private readonly IRepository<srm_pr_main, long> _mysql_srm_pr_main;
+        private readonly IRepository<mes_mooccupy, long> _mysql_mes_mooccupy;
+        private readonly IRepository<mes_morder, long> _mysql_mes_morder;
+        private readonly IRepository<mes_moentry, long> _mysql_mes_moentry;
+        private readonly IRepository<mes_process, long> _mysql_mes_process;
+        private readonly IRepository<mes_tech_process, long> _mysql_mes_tech_process;
+        private readonly IRepository<srm_po_main, long> _mysql_srm_po_main;
+        private readonly IRepository<srm_po_list, long> _mysql_srm_po_list;
+        private readonly IRepository<srm_po_occupy, long> _mysql_srm_po_occupy;
+        private readonly IRepository<ic_item_pur, long> _mysql_ic_item_pur;
+        private readonly IRepository<ic_plan, long> _mysql_ic_plan;
+
+
+        private readonly ICurrentTenant _currentTenant;
+
+        public CoreTestDataSeedContributor(
+            IRepository<ic_item, long> mysql_ic_item,
+            IRepository<ic_bom, long> mysql_ic_bom,
+            IRepository<ic_bom_child, long> mysql_ic_bom_child,
+            IRepository<mes_technique, long> mysql_mes_technique,
+            IRepository<crm_seorder, long> mysql_crm_seorder,
+            IRepository<crm_seorderentry, long> mysql_crm_seorderentry,
+            IRepository<ic_item_stock, long> mysql_ic_item_stock,
+            IRepository<ic_factory_details, long> mysql_ic_factory_details,
+            IRepository<mes_oorder, long> mysql_mes_oorder,
+            IRepository<srm_pr_main, long> mysql_srm_pr_main,
+            IRepository<mes_mooccupy, long> mysql_mes_mooccupy,
+            IRepository<mes_morder, long> mysql_mes_morder,
+            IRepository<mes_moentry, long> mysql_mes_moentry,
+            IRepository<mes_process, long> mysql_mes_process,
+            IRepository<mes_tech_process, long> mysql_mes_tech_process,
+            IRepository<srm_po_main, long> mysql_srm_po_main,
+            IRepository<srm_po_list, long> mysql_srm_po_list,
+            IRepository<srm_po_occupy, long> mysql_srm_po_occupy,
+            IRepository<ic_item_pur, long> mysql_ic_item_pur,
+            IRepository<ic_plan, long> mysql_ic_plan,
+        ICurrentTenant currentTenant)
+        {
+            _mysql_ic_item = mysql_ic_item;
+            _mysql_ic_bom = mysql_ic_bom;
+            _mysql_ic_bom_child = mysql_ic_bom_child;
+            _mysql_crm_seorder = mysql_crm_seorder;
+            _mysql_crm_seorderentry = mysql_crm_seorderentry;
+            _mysql_ic_item_stock = mysql_ic_item_stock;
+            _mysql_ic_factory_details = mysql_ic_factory_details;
+            _mysql_mes_oorder = mysql_mes_oorder;
+            _mysql_srm_pr_main = mysql_srm_pr_main;
+            _mysql_mes_mooccupy = mysql_mes_mooccupy;
+            _mysql_mes_morder = mysql_mes_morder;
+            _mysql_mes_moentry = mysql_mes_moentry;
+            _mysql_srm_po_main = mysql_srm_po_main;
+            _mysql_srm_po_list = mysql_srm_po_list;
+            _mysql_srm_po_occupy = mysql_srm_po_occupy;
+            _mysql_ic_item_pur = mysql_ic_item_pur;
+            _mysql_ic_plan = mysql_ic_plan;
+            _currentTenant = currentTenant;
+        }
+
+        public async Task SeedAsync(DataSeedContext context)
+        {
+            /* Seed additional test data... */
+            using (_currentTenant.Change(context?.TenantId))
+            {
+                await Seedic_itemAsync();
+                await Seedic_bomAsync();
+                await Seedic_bom_childAsync();
+                await Seedmes_techniqueAsync();
+
+            }
+        }
+
+
+        private async Task Seedic_itemAsync()
+        {
+            await _mysql_ic_item.InsertAsync(new ic_item { factory_id=102, allowout=1});
+        }
+
+        private async Task Seedic_bomAsync()
+        {
+            await _mysql_ic_bom.InsertAsync(new ic_bom { factory_id=102,fse_status=1});
+        }
+
+        public async Task Seedic_bom_childAsync()
+        {
+            await _mysql_ic_bom_child.InsertAsync(new ic_bom_child { factory_id=102, begin_day=DateTime.Now});
+        }
+
+        public async Task Seedmes_techniqueAsync()
+        {
+            await _mysql_mes_technique.InsertAsync(new mes_technique { factory_id=102, bom="1000"});
+        }
+    }
+}

+ 0 - 56
MicroServices/Business/Buissness.UnitTest/InitialData/UnitTestInitialDataBuilder.cs

@@ -1,56 +0,0 @@
-using Business.EntityFrameworkCore;
-using Business.Models;
-using Bussiness.Model.SIM;
-using Bussiness.Model.SystemData;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Buissness.UnitTest.InitialData
-{
-    public class UnitTestInitialDataBuilder
-    {
-        public void Build(BusinessDbContext context)
-        {
-            //Add some people
-
-            context.Book.AddRange(
-                new Book { Name = "Isaac Asimov", Price=1, Description="111",TenantId=Guid.NewGuid() },
-                new Book { Name = "Thomas More", Price = 2, Description = "222", TenantId = Guid.NewGuid() },
-                new Book { Name = "George Orwell",Price = 3, Description = "333", TenantId = Guid.NewGuid() },
-                new Book { Name = "Douglas Adams", Price = 4, Description = "444", TenantId = Guid.NewGuid() }
-                );
-
-            context.SaveChanges();
-
-            context.sim_base.AddRange(
-               new sim_base { sim_grade = "1", sim_level = 1, rise_cycle = (decimal?)0.5, interval_days = (decimal?)0.6, rise_time = DateTime.Now, factory_id = 10201, org_id = 102, tenant_id = 102 },
-               new sim_base { sim_grade = "2", sim_level = 2, rise_cycle = (decimal?)0.5, interval_days = (decimal?)0.7, rise_time = DateTime.Now, factory_id = 10201, org_id = 102, tenant_id = 102 },
-               new sim_base { sim_grade = "3", sim_level = 3, rise_cycle = (decimal?)0.5, interval_days = (decimal?)0.8, rise_time = DateTime.Now, factory_id = 10201, org_id = 102, tenant_id = 102 },
-               new sim_base { sim_grade = "4", sim_level = 4, rise_cycle = (decimal?)0.5, interval_days = (decimal?)0.9, rise_time = DateTime.Now, factory_id = 10201, org_id = 102, tenant_id = 102 }
-               );
-
-            context.SaveChanges();
-
-            context.sys_code.AddRange( 
-                new sys_code { code_name = "1", code_rule = "ABP1", code_value =1, chinese_name ="测试编码规则", code_date = DateTime.Now },
-                new sys_code { code_name = "2", code_rule = "ABP2", code_value = 1, chinese_name = "测试编码规则", code_date = DateTime.Now },
-                new sys_code { code_name = "3", code_rule = "ABP3", code_value = 1, chinese_name = "测试编码规则", code_date = DateTime.Now },
-                new sys_code { code_name = "4", code_rule = "ABP4", code_value = 1, chinese_name = "测试编码规则", code_date = DateTime.Now }
-                );
-
-            context.SaveChanges();
-
-            context.sys_code_pre.AddRange(
-                new sys_code_pre { code_name = "1", pre_name = context.sys_code.Single(p => p.code_name == "ABP1").code_rule, code_value = 1, code_date = DateTime.Now },
-                new sys_code_pre { code_name = "1", pre_name = context.sys_code.Single(p => p.code_name == "ABP2").code_rule, code_value = 2, code_date = DateTime.Now },
-                new sys_code_pre { code_name = "1", pre_name = context.sys_code.Single(p => p.code_name == "ABP3").code_rule, code_value = 3, code_date = DateTime.Now },
-                new sys_code_pre { code_name = "1", pre_name = context.sys_code.Single(p => p.code_name == "ABP4").code_rule, code_value = 4, code_date = DateTime.Now }
-                );
-
-            context.SaveChanges();
-        }
-    }
-}

+ 32 - 0
MicroServices/Business/Buissness.UnitTest/MES/IC/sim_issue_typeRepository_Tests.cs

@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Buissness.TestBase;
+using Business.Domain;
+using Shouldly;
+using Volo.Abp.Modularity;
+using Xunit;
+
+namespace Buissness.TestBase
+{
+    public abstract class sim_issue_typeRepository_Tests<TStartupModule> : CoreTestBase<TStartupModule>
+        where TStartupModule : IAbpModule
+    {
+        public Isim_issue_typeRepository sim_issue_typeRepository { get; set; }
+
+        public sim_issue_typeRepository_Tests()
+        {
+            sim_issue_typeRepository = GetRequiredService<Isim_issue_typeRepository>();
+        }
+
+        [Fact]
+        public async Task Should_Find_By_TypeName()
+        {
+            var blogFromRepository = (await sim_issue_typeRepository.GetListAsync()).First();
+            var ic_bom = await sim_issue_typeRepository.FindByItemNameAsync(blogFromRepository.type_name);
+            ic_bom.ShouldNotBeNull();
+        }
+    }
+}

+ 0 - 31
MicroServices/Business/Buissness.UnitTest/ResourceExamineManagement/ProductExamineAppServiceTest.cs

@@ -1,31 +0,0 @@
-using Business.Core.MongoDBHelper;
-using Business.ResourceExamineManagement;
-using Business.ResourceExamineManagement.Dto;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace Buissness.UnitTest.ResourceExamineManagement
-{
-    public class ProductExamineAppServiceTest: UnitTestBase
-    {
-        private readonly IResourceExamineAppService resourceExamineAppService;
-
-        public ProductExamineAppServiceTest()
-        {
-            //创建被测试的类(SUT(Software Under Test) - 被测系统)
-            resourceExamineAppService = LocalIocManager.Resolve<IResourceExamineAppService>();
-        }
-
-        [Fact]
-        public void ReceiveResult()
-        {
-            var input=new SeorderentryDto { factoryId=10,sorderId=0, tenantId=0 };
-
-        }
-
-    }
-}

+ 43 - 0
MicroServices/Business/Buissness.UnitTest/Security/FakeCurrentPrincipalAccessor.cs

@@ -0,0 +1,43 @@
+using System.Collections.Generic;
+using System.Security.Claims;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Security.Claims;
+
+namespace Buissness.TestBase
+{
+    [Dependency(ReplaceServices = true)]
+    public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor
+    {
+        protected override ClaimsPrincipal GetClaimsPrincipal()
+        {
+            return GetPrincipal();
+        }
+
+        private ClaimsPrincipal _principal;
+
+        private ClaimsPrincipal GetPrincipal()
+        {
+            if (_principal == null)
+            {
+                lock (this)
+                {
+                    if (_principal == null)
+                    {
+                        _principal = new ClaimsPrincipal(
+                            new ClaimsIdentity(
+                                new List<Claim>
+                                {
+                                    new Claim(AbpClaimTypes.UserId,"2e701e62-0953-4dd3-910b-dc6cc93ccb0d"),
+                                    new Claim(AbpClaimTypes.UserName,"admin"),
+                                    new Claim(AbpClaimTypes.Email,"admin@abp.io")
+                                }
+                            )
+                        );
+                    }
+                }
+            }
+
+            return _principal;
+        }
+    }
+}

+ 0 - 59
MicroServices/Business/Buissness.UnitTest/UnitTestBase.cs

@@ -1,59 +0,0 @@
-using Abp.TestBase;
-using Buissness.UnitTest.InitialData;
-using Business.Core.MongoDBHelper;
-using Business.EntityFrameworkCore;
-using Castle.MicroKernel.Registration;
-using System.Data.Common;
-using Volo.Abp.Modularity;
-
-namespace Buissness.UnitTest
-{
-    /// <summary>
-    /// 这是所有测试类的基础类。
-    /// 它准备了ABP系统,模块和一个假的内存数据库。
-    /// 具有初始数据的种子数据库(<see cref =“SimpleTaskSystemInitialDataBuilder”/>)。
-    /// 提供使用DbContext轻松使用的方法。
-    /// </summary>
-    public abstract class UnitTestBase: AbpIntegratedTestBase<UnitTestModule>
-    {
-        protected UnitTestBase()
-        {
-            //种子初始数据
-            UsingDbContext(context => new UnitTestInitialDataBuilder().Build(context));
-        }
-
-
-        protected override void PreInitialize()
-        {
-            //假DbConnection使用Effort!
-            LocalIocManager.IocContainer.Register(
-                Component.For<DbConnection>()
-                    .UsingFactoryMethod(Effort.DbConnectionFactory.CreateTransient)
-                    .LifestyleSingleton()
-                );
-            base.PreInitialize();
-        }
-
-        public void UsingDbContext(Action<BusinessDbContext> action)
-        {
-            using (var context = LocalIocManager.Resolve<BusinessDbContext>())
-            {
-                action(context);
-                context.SaveChanges();
-            }
-        }
-
-        public T UsingDbContext<T>(Func<BusinessDbContext, T> func)
-        {
-            T result;
-
-            using (var context = LocalIocManager.Resolve<BusinessDbContext>())
-            {
-                result = func(context);
-                context.SaveChanges();
-            }
-
-            return result;
-        }
-    }
-}

+ 0 - 20
MicroServices/Business/Buissness.UnitTest/UnitTestModule.cs

@@ -1,20 +0,0 @@
-using Abp.Modules;
-using Business;
-using Business.EntityFrameworkCore;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Buissness.UnitTest
-{
-    [DependsOn(
-         typeof(BusinessEntityFrameworkCoreModule),
-         typeof(BusinessApplicationModule)
-     )]
-    public class UnitTestModule: AbpModule
-    {
-
-    }
-}

+ 0 - 30
MicroServices/Business/Business.Application.Contracts/BookManagement/Dto/BookDto.cs

@@ -1,30 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Volo.Abp.Application.Dtos;
-using System.ComponentModel.DataAnnotations;
-namespace Business.BookManagement.Dto
-{
-    public class BookDto : EntityDto<Guid?>
-    {
-        
-        /// <summary>
-        /// 书名
-        /// </summary>
-        [Required]
-        public string Name { get; set; }
-
-        
-        /// <summary>
-        /// 描述
-        /// </summary>
-        public string Description { get; set; }
-
-        
-        /// <summary>
-        /// 价格
-        /// </summary>
-        public int Price { get; set; }
-
-        
-    }
-}

+ 0 - 31
MicroServices/Business/Business.Application.Contracts/BookManagement/Dto/CreateOrUpdateBookDto.cs

@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using Volo.Abp.Application.Dtos;
-
-namespace Business.BookManagement.Dto
-{
-    public class CreateOrUpdateBookDto: EntityDto<Guid?>
-    {
-        
-        /// <summary>
-        /// 书名
-        /// </summary>
-        [Required]
-        public string Name { get; set; }
-
-        
-        /// <summary>
-        /// 描述
-        /// </summary>
-        public string Description { get; set; }
-
-        
-        /// <summary>
-        /// 价格
-        /// </summary>
-        public int Price { get; set; }
-
-        
-    }
-}

+ 0 - 10
MicroServices/Business/Business.Application.Contracts/BookManagement/Dto/GetBookInputDto.cs

@@ -1,10 +0,0 @@
-using System;
-using Volo.Abp.Application.Dtos;
-
-namespace Business.BookManagement.Dto
-{
-    public class GetBookInputDto : PagedAndSortedResultRequestDto
-    {
-        public string Filter { get; set; }
-    }
-}

+ 0 - 17
MicroServices/Business/Business.Application.Contracts/BookManagement/IBookAppService.cs

@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Volo.Abp.Application.Dtos;
-using Volo.Abp.Application.Services;
-using Business.BookManagement.Dto;
-
-namespace Business.BookManagement
-{
-    public interface IBookAppService : IApplicationService
-    {
-        Task<BookDto> Get(Guid id);
-        Task<PagedResultDto<BookDto>> GetAll(GetBookInputDto input);
-        Task<BookDto> CreateOrUpdate(CreateOrUpdateBookDto input);
-        Task Delete(List<Guid> ids);
-    }
-}

+ 0 - 5
MicroServices/Business/Business.Application.Contracts/Permissions/BusinessPermissionDefinitionProvider.cs

@@ -27,11 +27,6 @@ namespace Business.Permissions
             PrintTemplate.AddChild(BusinessPermissions.ResourceExamine.Delete, L("Delete"));
             PrintTemplate.AddChild(BusinessPermissions.ResourceExamine.Create, L("Create"));
 
-            var ThinkFlow = Business.AddPermission(BusinessPermissions.ThinkFlow.Default, L("ThinkFlow"));
-            ThinkFlow.AddChild(BusinessPermissions.ThinkFlow.Update, L("Edit"));
-            ThinkFlow.AddChild(BusinessPermissions.ThinkFlow.Delete, L("Delete"));
-            ThinkFlow.AddChild(BusinessPermissions.ThinkFlow.Create, L("Create"));
-
             //Code generation...
         }
 

+ 0 - 8
MicroServices/Business/Business.Application.Contracts/Permissions/BusinessPermissions.cs

@@ -32,14 +32,6 @@ namespace Business.Permissions
             public const string Create = Default + ".Create";
         }
 
-        public static class ThinkFlow
-        {
-            public const string Default = Business + ".ThinkFlow";
-            public const string Delete = Default + ".Delete";
-            public const string Update = Default + ".Update";
-            public const string Create = Default + ".Create";
-        }
-
         //Code generation...
     }
 }

+ 0 - 72
MicroServices/Business/Business.Application.Contracts/PrintTemplateManagement/Dto/CreateOrUpdatePrintTemplateDto.cs

@@ -1,72 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using Volo.Abp.Application.Dtos;
-
-namespace Business.PrintTemplateManagement.Dto
-{
-    public class CreateOrUpdatePrintTemplateDto: EntityDto<Guid?>
-    {
-        
-        /// <summary>
-        /// 模板名称
-        /// </summary>
-        [Required]
-        public string Name { get; set; }
-        
-        /// <summary>
-        /// 模板类型
-        /// </summary>
-        [Required]
-        public int TempType { get; set; }
-        
-        /// <summary>
-        /// 默认
-        /// </summary>
-        [Required]
-        public bool IsDefault { get; set; }
-        
-        /// <summary>
-        /// 状态
-        /// </summary>
-        [Required]
-        public int Status { get; set; }
-        
-        /// <summary>
-        /// 排序
-        /// </summary>
-        [Required]
-        public int Sort { get; set; }
-        
-        /// <summary>
-        /// 模板内容
-        /// </summary>
-        public string Content { get; set; }
-        
-        /// <summary>
-        /// 备注
-        /// </summary>
-        public string Remark { get; set; }
-
-        /// <summary>
-        /// 打印方向
-        /// </summary>
-        public int? Orientation { get; set; }
-
-        /// <summary>
-        /// 纸张类型
-        /// </summary>
-        public int? PaperKind { get; set; }
-
-        /// <summary>
-        /// 纸张宽度
-        /// </summary>
-        public string PaperWidth { get; set; }
-
-        /// <summary>
-        /// 纸张高度
-        /// </summary>
-        public string PaperHeight { get; set; }
-
-    }
-}

+ 0 - 12
MicroServices/Business/Business.Application.Contracts/PrintTemplateManagement/Dto/GetPrintTemplateInputDto.cs

@@ -1,12 +0,0 @@
-using System;
-using Volo.Abp.Application.Dtos;
-
-namespace Business.PrintTemplateManagement.Dto
-{
-    public class GetPrintTemplateInputDto : PagedAndSortedResultRequestDto
-    {
-        public Guid? Id { get; set; }
-
-        public string Filter { get; set; }
-    }
-}

+ 0 - 72
MicroServices/Business/Business.Application.Contracts/PrintTemplateManagement/Dto/PrintTemplateDto.cs

@@ -1,72 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Volo.Abp.Application.Dtos;
-using System.ComponentModel.DataAnnotations;
-
-namespace Business.PrintTemplateManagement.Dto
-{
-    public class PrintTemplateDto : EntityDto<Guid?>
-    {
-        
-        /// <summary>
-        /// 模板名称
-        /// </summary>
-        [Required]
-        public string Name { get; set; }
-        
-        /// <summary>
-        /// 模板类型
-        /// </summary>
-        [Required]
-        public int TempType { get; set; }
-        
-        /// <summary>
-        /// 默认
-        /// </summary>
-        [Required]
-        public bool IsDefault { get; set; }
-        
-        /// <summary>
-        /// 状态
-        /// </summary>
-        [Required]
-        public int Status { get; set; }
-        
-        /// <summary>
-        /// 排序
-        /// </summary>
-        [Required]
-        public int Sort { get; set; }
-        
-        /// <summary>
-        /// 模板内容
-        /// </summary>
-        public string Content { get; set; }
-        
-        /// <summary>
-        /// 备注
-        /// </summary>
-        public string Remark { get; set; }
-
-        /// <summary>
-        /// 打印方向
-        /// </summary>
-        public int? Orientation { get; set; }
-
-        /// <summary>
-        /// 纸张类型
-        /// </summary>
-        public int? PaperKind { get; set; }
-
-        /// <summary>
-        /// 纸张宽度
-        /// </summary>
-        public string PaperWidth { get; set; }
-
-        /// <summary>
-        /// 纸张高度
-        /// </summary>
-        public string PaperHeight { get; set; }
-
-    }
-}

+ 0 - 22
MicroServices/Business/Business.Application.Contracts/PrintTemplateManagement/IPrintTemplateAppService.cs

@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Volo.Abp.Application.Dtos;
-using Volo.Abp.Application.Services;
-using Business.PrintTemplateManagement.Dto;
-
-namespace Business.PrintTemplateManagement
-{
-    public interface IPrintTemplateAppService : IApplicationService
-    {
-        Task<PrintTemplateDto> Get(Guid id);
-
-        Task<PagedResultDto<PrintTemplateDto>> GetAll(GetPrintTemplateInputDto input);
-
-        Task<PrintTemplateDto> DataPost(CreateOrUpdatePrintTemplateDto input);
-
-        Task Delete(List<Guid> ids);
-
-        Task<dynamic> CreatePdf(Guid id);
-    }
-}

+ 0 - 2
MicroServices/Business/Business.Application.Contracts/ResourceExamineManagement/Dto/BomDto.cs

@@ -6,8 +6,6 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using Business;
-using Business.BookManagement;
-using Business.BookManagement.Dto;
 using Business.ResourceExamineManagement.Dto;
 
 namespace Business.ResourceExamineManagement.Dto

+ 18 - 0
MicroServices/Business/Business.Application.Test/Business.Application.Test.csproj

@@ -0,0 +1,18 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
+    <PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
+    <PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
+    <PackageReference Include="coverlet.collector" Version="3.1.2" />
+  </ItemGroup>
+
+</Project>

+ 11 - 0
MicroServices/Business/Business.Application.Test/UnitTest1.cs

@@ -0,0 +1,11 @@
+namespace Business.Application.Test
+{
+    [TestClass]
+    public class UnitTest1
+    {
+        [TestMethod]
+        public void TestMethod1()
+        {
+        }
+    }
+}

+ 1 - 0
MicroServices/Business/Business.Application.Test/Usings.cs

@@ -0,0 +1 @@
+global using Microsoft.VisualStudio.TestTools.UnitTesting;

+ 0 - 82
MicroServices/Business/Business.Application/BookManagement/BookAppService.cs

@@ -1,82 +0,0 @@
-using Microsoft.EntityFrameworkCore;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Dynamic.Core;
-using System.Threading.Tasks;
-using Volo.Abp.Application.Dtos;
-using Volo.Abp.Domain.Repositories;
-using Business.BookManagement.Dto;
-using Business.Models;
-using Microsoft.AspNetCore.Authorization;
-using Business.Permissions;
-using XCZ;
-
-namespace Business.BookManagement
-{
-    [Authorize(BusinessPermissions.Book.Default)]
-    public class BookAppService : BusinessWorkFlowAppService, IBookAppService
-    {
-        private const string FormName = "Book";
-        private IRepository<Book, Guid> _repository;
-
-        public BookAppService(
-            IRepository<Book, Guid> repository
-            )
-        {
-            _repository = repository;
-        }
-        #region 增删改查基础方法
-
-        public async Task<BookDto> Get(Guid id)
-        {
-            var data = await _repository.GetAsync(id);
-            var dto = ObjectMapper.Map<Book, BookDto>(data);
-            return dto;
-        }
-
-        public async Task<PagedResultDto<BookDto>> GetAll(GetBookInputDto input)
-        {
-            var query = (await _repository.GetQueryableAsync()).WhereIf(!string.IsNullOrWhiteSpace(input.Filter), a => a.Name.Contains(input.Filter));
-
-            var totalCount = await query.CountAsync();
-            var items = await query.OrderBy(input.Sorting ?? "Id")
-                        .ToListAsync();
-
-            var dtos = ObjectMapper.Map<List<Book>, List<BookDto>>(items);
-            return new PagedResultDto<BookDto>(totalCount, dtos);
-        }
-
-        public async Task<BookDto> CreateOrUpdate(CreateOrUpdateBookDto input)
-        {
-            Book result = null;
-            if (!input.Id.HasValue)
-            {
-                input.Id = GuidGenerator.Create();
-                result = await _repository.InsertAsync(ObjectMapper.Map<CreateOrUpdateBookDto, Book>(input));
-
-                //创建工作流
-                await WorkFlow.CreateWorkFlow(FormName, result);
-            }
-            else
-            {
-                var data = await _repository.GetAsync(input.Id.Value);
-                result = await _repository.UpdateAsync(ObjectMapper.Map(input, data));
-                //检查流程状态
-                await WorkFlow.CheckFormStatus(input.Id.Value, result);
-            }
-            return ObjectMapper.Map<Book, BookDto>(result);
-        }
-
-        public async Task Delete(List<Guid> ids)
-        {
-            foreach (var item in ids)
-            {
-                await _repository.DeleteAsync(item);
-            }
-
-        }
-        #endregion
-
-    }
-}

+ 0 - 15
MicroServices/Business/Business.Application/BookManagement/BookAutoMapperProfile.cs

@@ -1,15 +0,0 @@
-using AutoMapper;
-using Business.BookManagement.Dto;
-using Business.Models;
-
-namespace Business.BookManagement
-{
-    public class BookAutoMapperProfile : Profile
-    {
-        public BookAutoMapperProfile()
-        {
-            CreateMap<Book, BookDto>();
-            CreateMap<CreateOrUpdateBookDto, Book>();
-        }
-    }
-}

+ 0 - 2
MicroServices/Business/Business.Application/Business.Application.csproj

@@ -17,8 +17,6 @@
 	<PackageReference Include="Volo.Abp.Ddd.Application" Version="6.0.0" />
     <PackageReference Include="Volo.Abp.Identity.HttpApi.Client" Version="6.0.0" />
     <PackageReference Include="XCZ.BaseService.HttpApi.Client" Version="1.0.0" />
-    <PackageReference Include="XCZ.FlowManagement.Application" Version="1.3.1" />
-    <PackageReference Include="XCZ.FormManagement.Application" Version="2.3.0" />
   </ItemGroup>
 
   <ItemGroup>

+ 0 - 3
MicroServices/Business/Business.Application/BusinessApplicationModule.cs

@@ -4,7 +4,6 @@ using Volo.Abp.AutoMapper;
 using Volo.Abp.Http.Client.IdentityModel;
 using Volo.Abp.Identity;
 using Volo.Abp.Modularity;
-using XCZ;
 
 namespace Business
 {
@@ -15,8 +14,6 @@ namespace Business
         typeof(AbpHttpClientIdentityModelModule),
         typeof(AbpIdentityHttpApiClientModule),
         typeof(BaseServiceHttpApiClientModule),
-        typeof(FormApplicationModule),
-        typeof(FlowApplicationModule),
         typeof(AbpAutoMapperModule)
     )]
     public class BusinessApplicationModule : AbpModule

+ 0 - 96
MicroServices/Business/Business.Application/PrintTemplateManagement/PrintTemplateAppService.cs

@@ -1,96 +0,0 @@
-using Microsoft.EntityFrameworkCore;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Dynamic.Core;
-using System.Threading.Tasks;
-using Volo.Abp.Application.Dtos;
-using Volo.Abp.Application.Services;
-using Volo.Abp.Domain.Repositories;
-using Business.PrintTemplateManagement.Dto;
-using Business.Models;
-using Microsoft.AspNetCore.Authorization;
-using Business.Permissions;
-using Volo.Abp;
-using Magicodes.ExporterAndImporter.Pdf;
-using WkHtmlToPdfDotNet;
-using Microsoft.AspNetCore.Mvc;
-using System.IO;
-
-namespace Business.PrintTemplateManagement
-{
-    [Authorize(BusinessPermissions.PrintTemplate.Default)]
-    public class PrintTemplateAppService : ApplicationService, IPrintTemplateAppService
-    {
-        private const string FormName = "PrintTemplate";
-        private IRepository<PrintTemplate, Guid> _repository;
-
-        public PrintTemplateAppService(
-            IRepository<PrintTemplate, Guid> repository
-            )
-        {
-            _repository = repository;
-        }
-        #region 增删改查基础方法
-
-        public async Task<PrintTemplateDto> Get(Guid id)
-        {
-            var data = await _repository.GetAsync(id);
-            var dto = ObjectMapper.Map<PrintTemplate, PrintTemplateDto>(data);
-            return dto;
-        }
-
-        public async Task<PagedResultDto<PrintTemplateDto>> GetAll(GetPrintTemplateInputDto input)
-        {
-            var query = (await _repository.GetQueryableAsync()).WhereIf(!string.IsNullOrWhiteSpace(input.Filter), a => a.Name.Contains(input.Filter));
-
-            var totalCount = await query.CountAsync();
-            var items = await query.OrderBy(input.Sorting ?? "Id")
-                       .Skip(input.SkipCount)
-                       .Take(input.MaxResultCount)
-                       .ToListAsync();
-
-            var dto = ObjectMapper.Map<List<PrintTemplate>, List<PrintTemplateDto>>(items);
-            return new PagedResultDto<PrintTemplateDto>(totalCount, dto);
-        }
-
-        public async Task<PrintTemplateDto> DataPost(CreateOrUpdatePrintTemplateDto input)
-        {
-            PrintTemplate result = null;
-            if (!input.Id.HasValue)
-            {
-                input.Id = GuidGenerator.Create();
-                result = await _repository.InsertAsync(ObjectMapper.Map<CreateOrUpdatePrintTemplateDto, PrintTemplate>(input));
-            }
-            else
-            {
-                var data = await _repository.GetAsync(input.Id.Value);
-                result = await _repository.UpdateAsync(ObjectMapper.Map(input, data));
-            }
-            return ObjectMapper.Map<PrintTemplate, PrintTemplateDto>(result);
-        }
-
-        public async Task Delete(List<Guid> ids)
-        {
-            foreach (var item in ids)
-            {
-                await _repository.DeleteAsync(item);
-            }
-
-        }
-
-        public async Task<dynamic> CreatePdf(Guid id)
-        {
-            var temp = await _repository.GetAsync(id);
-            var exporter = new PdfExporter();
-            var pdfAtt = new PdfExporterAttribute();
-            pdfAtt.Orientation = Orientation.Landscape;
-            pdfAtt.PaperKind = PaperKind.A4;
-            var result = await exporter.ExportBytesByTemplate(temp, pdfAtt, temp.Content);
-            return new FileStreamResult(new MemoryStream(result), "application/octet-stream") { FileDownloadName = $"{temp.Name}.PDF" };
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 15
MicroServices/Business/Business.Application/PrintTemplateManagement/PrintTemplateAutoMapperProfile.cs

@@ -1,15 +0,0 @@
-using AutoMapper;
-using Business.PrintTemplateManagement.Dto;
-using Business.Models;
-
-namespace Business.PrintTemplateManagement
-{
-    public class PrintTemplateAutoMapperProfile : Profile
-    {
-        public PrintTemplateAutoMapperProfile()
-        {
-            CreateMap<PrintTemplate, PrintTemplateDto>();
-            CreateMap<CreateOrUpdatePrintTemplateDto, PrintTemplate>();
-        }
-    }
-}

+ 0 - 11
MicroServices/Business/Business.Application/ResourceExamineManagement/MorderAppService.cs

@@ -1,25 +1,14 @@
 using Business.Core.Enum;
-using Business.Core.MongoDBHelper;
 using Business.Core.Utilities;
 using Business.ResourceExamineManagement.Dto;
-using Bussiness.Model.MES.IC;
-using Bussiness.Model.Production;
 using Bussiness.Model.Sale;
-using Bussiness.Model.SRM;
-using Bussiness.Model.Tech;
 using Bussiness.MongoModel.MES.IC;
 using Bussiness.MongoModel.Production;
 using Bussiness.MongoModel.Tech;
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Threading.Tasks.Dataflow;
 using Volo.Abp.Application.Services;
-using Volo.Abp.Domain.Repositories;
-using ZstdSharp.Unsafe;
 
 namespace Business.ResourceExamineManagement
 {

+ 1 - 1
MicroServices/Business/Business.Core/Business.Core.csproj

@@ -11,7 +11,7 @@
     <PackageReference Include="MongoDB.Driver" Version="2.19.0" />
     <PackageReference Include="MongoDB.Driver.Core" Version="2.19.0" />
     <PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
-    <PackageReference Include="Volo.Abp.Ddd.Domain" Version="6.0.2" />
+    <PackageReference Include="Volo.Abp.Ddd.Domain" Version="6.0.0" />
   </ItemGroup>
 
 </Project>

+ 5 - 3
MicroServices/Business/Business.Domain/Business.Domain.csproj

@@ -23,11 +23,13 @@
 
   <ItemGroup>
     <PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="6.0.0" />
-    <PackageReference Include="Volo.Abp.Ddd.Domain" Version="6.0.0" />
-    <PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="6.0.0" />
-    <PackageReference Include="Volo.Abp.Localization" Version="6.0.0" />
+    <PackageReference Include="Volo.Abp.Localization" Version="6.0.2" />
     <PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="6.0.0" />
     <PackageReference Include="Volo.Abp.Validation" Version="6.0.0" />
   </ItemGroup>
 
+  <ItemGroup>
+    <ProjectReference Include="..\Bussiness.Model\Bussiness.Model.csproj" />
+  </ItemGroup>
+
 </Project>

+ 17 - 0
MicroServices/Business/Business.Domain/Isim_issue_typeRepository.cs

@@ -0,0 +1,17 @@
+using Bussiness.Model.MES.IC;
+using Bussiness.Model.SIM;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Repositories;
+
+namespace Business.Domain
+{
+    public interface Isim_issue_typeRepository : IBasicRepository<sim_issue_type, long>
+    {
+        Task<sim_issue_type> FindByItemNameAsync(string itemName, CancellationToken cancellationToken = default);
+    }
+}

+ 0 - 33
MicroServices/Business/Business.Domain/Models/Book.cs

@@ -1,33 +0,0 @@
-using System;
-using Volo.Abp;
-using Volo.Abp.Domain.Entities.Auditing;
-using Volo.Abp.MultiTenancy;
-using System.ComponentModel.DataAnnotations;
-namespace Business.Models
-{
-    public class Book: AuditedAggregateRoot<Guid>, ISoftDelete, IMultiTenant
-    {
-        public Guid? TenantId { get; set; }
-        public bool IsDeleted { get; set; }
-        
-        /// <summary>
-        /// 书名
-        /// </summary>
-        [Required]
-        public string Name { get; set; }
-
-        
-        /// <summary>
-        /// 描述
-        /// </summary>
-        public string Description { get; set; }
-
-        
-        /// <summary>
-        /// 价格
-        /// </summary>
-        public int Price { get; set; }
-
-        
-    }
-}

+ 0 - 76
MicroServices/Business/Business.Domain/Models/PrintTemplate.cs

@@ -1,76 +0,0 @@
-using System;
-using Volo.Abp;
-using Volo.Abp.Domain.Entities.Auditing;
-using Volo.Abp.MultiTenancy;
-using System.ComponentModel.DataAnnotations;
-
-namespace Business.Models
-{
-    /// <summary>
-    /// 打印模板
-    /// </summary>
-    public class PrintTemplate: AuditedAggregateRoot<Guid>, ISoftDelete, IMultiTenant
-    {
-        public Guid? TenantId { get; set; }
-        
-        /// <summary>
-        /// 模板名称
-        /// </summary>
-        public string Name { get; set; }
-
-        /// <summary>
-        /// 模板类型:0设计模板,1指令模板
-        /// </summary>
-        public int TempType { get; set; }
-        
-        /// <summary>
-        /// 默认
-        /// </summary>
-        public bool IsDefault { get; set; }
-
-        /// <summary>
-        /// 状态:0禁用,1启用
-        /// </summary>
-        public int Status { get; set; }
-        
-        /// <summary>
-        /// 排序
-        /// </summary>
-        public int Sort { get; set; }
-        
-        /// <summary>
-        /// 模板内容
-        /// </summary>
-        public string Content { get; set; }
-        
-        /// <summary>
-        /// 备注
-        /// </summary>
-        public string Remark { get; set; }
-
-        #region  PdfExporterAttribute
-        /// <summary>
-        /// 打印方向
-        /// </summary>
-        public int? Orientation { get; set; }
-
-        /// <summary>
-        /// 纸张大小
-        /// </summary>
-        public int? PaperKind { get; set; }
-
-        /// <summary>
-        /// 纸张宽度
-        /// </summary>
-        public double? PaperWidth { get; set; }
-
-        /// <summary>
-        /// 纸张高度
-        /// </summary>
-        public double? PaperHeight { get; set; }
-        #endregion
-        
-		
-		public bool IsDeleted { get; set; }
-    }
-}

+ 2 - 3
MicroServices/Business/Business.EntityFrameworkCore/Business.EntityFrameworkCore.csproj

@@ -16,11 +16,10 @@
     </PackageReference>
     <PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="6.0.0" />
     <PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="6.0.2" />
+    <PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="4.4.0" />
     <PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="6.0.0" />
-    <PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="6.0.0" />
+    <PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="6.0.3" />
     <PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="6.0.0" />
-    <PackageReference Include="XCZ.FlowManagement.EntityFrameworkCore" Version="1.2.5" />
-    <PackageReference Include="XCZ.FormManagement.EntityFrameworkCore" Version="2.1.3" />
   </ItemGroup>
 
   <ItemGroup>

+ 5 - 10
MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/BusinessDbContext.cs

@@ -1,5 +1,3 @@
-using Business.Model;
-using Business.Models;
 using Bussiness.Model.MES.IC;
 using Bussiness.Model.Production;
 using Bussiness.Model.ProductionProcess;
@@ -9,22 +7,19 @@ using Bussiness.Model.SRM;
 using Bussiness.Model.SystemData;
 using Bussiness.Model.Tech;
 using Microsoft.EntityFrameworkCore;
-using System;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
 using Volo.Abp.Data;
+using Volo.Abp.DependencyInjection;
 using Volo.Abp.EntityFrameworkCore;
+using Volo.Abp.Identity;
+using Volo.Abp.Identity.EntityFrameworkCore;
+using Volo.Abp.TenantManagement;
+using Volo.Abp.TenantManagement.EntityFrameworkCore;
 
 namespace Business.EntityFrameworkCore
 {
     [ConnectionStringName("Default")]
     public class BusinessDbContext : AbpDbContext<BusinessDbContext>
     {
-        public DbSet<Book> Book { get; set; }
-
-        public DbSet<PrintTemplate> PrintTemplate { get; set; }
-
         #region MES/IC
         public DbSet<ic_bom> ic_bom { get; set; }
         public DbSet<ic_bom_child> ic_bom_child { get; set; }

+ 0 - 21
MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/BusinessDbContextModelCreatingExtensions.cs

@@ -1,5 +1,4 @@
 using Business.Model;
-using Business.Models;
 using Bussiness.Model.MES.IC;
 using Bussiness.Model.Production;
 using Bussiness.Model.ProductionProcess;
@@ -26,26 +25,6 @@ namespace Business.EntityFrameworkCore
         {
             //TODO:这样太麻烦了,有时间研究一下批量
             Check.NotNull(builder, nameof(builder));
-            builder.Entity<Book>(b =>
-            {
-                b.ToTable("Book");
-
-                b.ConfigureByConvention();
-
-                b.Property(x => x.Name).IsRequired();
-
-
-            });
-
-            builder.Entity<PrintTemplate>(b =>
-            {
-                b.ToTable("base_print_template");
-
-                b.ConfigureByConvention();
-
-                b.Property(x => x.Name).IsRequired();
-            });
-
             builder.Entity<ic_bom>(b =>
             {
                 b.ToTable("ic_bom");

+ 1 - 4
MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/BusinessEntityFrameworkCoreModule.cs

@@ -5,7 +5,6 @@ using Volo.Abp.Modularity;
 using Volo.Abp.PermissionManagement.EntityFrameworkCore;
 using Volo.Abp.SettingManagement.EntityFrameworkCore;
 using Volo.Abp.TenantManagement.EntityFrameworkCore;
-using XCZ.EntityFrameworkCore;
 
 namespace Business.EntityFrameworkCore
 {
@@ -15,9 +14,7 @@ namespace Business.EntityFrameworkCore
         typeof(AbpPermissionManagementEntityFrameworkCoreModule),
         typeof(AbpSettingManagementEntityFrameworkCoreModule),
         typeof(AbpAuditLoggingEntityFrameworkCoreModule),
-        typeof(AbpTenantManagementEntityFrameworkCoreModule),
-        typeof(FormEntityFrameworkCoreModule),
-        typeof(FlowEntityFrameworkCoreModule)
+        typeof(AbpTenantManagementEntityFrameworkCoreModule)
     )]
     public class BusinessEntityFrameworkCoreModule : AbpModule
     {

+ 1 - 1
MicroServices/Business/Business.Host/Business.Host.csproj

@@ -24,7 +24,7 @@
     <PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="6.0.0" />
     <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="6.0.0" />
     <PackageReference Include="Volo.Abp.Autofac" Version="6.0.0" />
-    <PackageReference Include="Volo.Abp.Caching" Version="6.0.0" />
+    <PackageReference Include="Volo.Abp.Caching" Version="6.0.3" />
     <PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="6.0.2" />
   </ItemGroup>
 

+ 2 - 3
MicroServices/Business/Business.Host/EntityFrameworkCore/BusinessMigrationDbContext.cs

@@ -4,7 +4,6 @@ using System.ComponentModel;
 using System.Linq;
 using System.Reflection;
 using Volo.Abp.EntityFrameworkCore;
-using XCZ.EntityFrameworkCore;
 
 namespace Business.EntityFrameworkCore
 {
@@ -21,8 +20,8 @@ namespace Business.EntityFrameworkCore
         {
             base.OnModelCreating(modelBuilder);
             //改用低代码平台的表单流程
-            modelBuilder.ConfigureForm();
-            modelBuilder.ConfigureFlow();
+            //modelBuilder.ConfigureForm();
+            //modelBuilder.ConfigureFlow();
             modelBuilder.ConfigureBusiness();
         }
     }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
MicroServices/Business/Business.Host/tempkey.jwk


+ 0 - 52
MicroServices/Business/Business.HttpApi/Controllers/BookController.cs

@@ -1,52 +0,0 @@
-using Business.BookManagement;
-using Business.BookManagement.Dto;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Volo.Abp;
-using Volo.Abp.Application.Dtos;
-using Volo.Abp.AspNetCore.Mvc;
-
-namespace Business.Controllers
-{
-    [RemoteService]
-    [Area("Business")]
-    [Route("api/business/book")]
-    public class BookController : AbpController
-    {
-        private readonly IBookAppService _BookAppService;
-
-        public BookController(IBookAppService BookAppService)
-        {
-            _BookAppService = BookAppService;
-        }
-
-        [HttpPost]
-        [Route("data-post")]
-        public Task<BookDto> CreateOrUpdate(CreateOrUpdateBookDto input)
-        {
-            return _BookAppService.CreateOrUpdate(input);
-        }
-
-        [HttpPost]
-        [Route("delete")]
-        public Task Delete(List<Guid> ids)
-        {
-            return _BookAppService.Delete(ids);
-        }
-
-        [HttpGet]
-        [Route("{id}")]
-        public Task<BookDto> Get(Guid id)
-        {
-            return _BookAppService.Get(id);
-        }
-
-        [HttpGet]
-        public Task<PagedResultDto<BookDto>> GetAll(GetBookInputDto input)
-        {
-            return _BookAppService.GetAll(input);
-        }
-    }
-}

+ 0 - 60
MicroServices/Business/Business.HttpApi/Controllers/PrintTemplateController.cs

@@ -1,60 +0,0 @@
-using Business.PrintTemplateManagement;
-using Business.PrintTemplateManagement.Dto;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Threading.Tasks;
-using Volo.Abp;
-using Volo.Abp.Application.Dtos;
-using Volo.Abp.AspNetCore.Mvc;
-
-namespace Business.Controllers
-{
-    [RemoteService]
-    [Area("Business")]
-    [Route("api/business/print-template")]
-    public class PrintTemplateController : AbpController
-    {
-        private readonly IPrintTemplateAppService _PrintTemplateAppService;
-
-        public PrintTemplateController(IPrintTemplateAppService PrintTemplateAppService)
-        {
-            _PrintTemplateAppService = PrintTemplateAppService;
-        }
-
-        [HttpPost]
-        [Route("data-post")]
-        public Task<PrintTemplateDto> DataPost(CreateOrUpdatePrintTemplateDto input)
-        {
-            return _PrintTemplateAppService.DataPost(input);
-        }
-
-        [HttpPost]
-        [Route("delete")]
-        public Task Delete(List<Guid> ids)
-        {
-            return _PrintTemplateAppService.Delete(ids);
-        }
-
-        [HttpGet]
-        [Route("{id}")]
-        public Task<PrintTemplateDto> Get(Guid id)
-        {
-            return _PrintTemplateAppService.Get(id);
-        }
-
-        [HttpGet]
-        public Task<PagedResultDto<PrintTemplateDto>> GetAll(GetPrintTemplateInputDto input)
-        {
-            return _PrintTemplateAppService.GetAll(input);
-        }
-
-        [HttpGet]
-        [Route("pdf/{id}")]
-        public Task<dynamic> CreatePdf(Guid id)
-        {
-            return _PrintTemplateAppService.CreatePdf(id);
-        }
-    }
-}

+ 23 - 1
MicroServices/Business/Business.sln

@@ -27,7 +27,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{4523E5A9-9
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Business.Test", "Business.Test\Business.Test.csproj", "{66017D12-2115-4DC9-B400-E5E57EE2D16E}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Buissness.UnitTest", "Buissness.UnitTest\Buissness.UnitTest.csproj", "{DFAA3146-7008-4F54-B48B-013E80208376}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Buissness.TestBase", "Buissness.UnitTest\Buissness.TestBase.csproj", "{DFAA3146-7008-4F54-B48B-013E80208376}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bussiness.ApplicationTest", "Bussiness.ApplicationTest\Bussiness.ApplicationTest.csproj", "{9BDE4DA1-1F56-410D-A1A7-53EB3E8848B2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bussiness.EntityFrameworkCore.Test", "Bussiness.EntityFrameworkCore.Test\Bussiness.EntityFrameworkCore.Test.csproj", "{CEFD0FFD-FAF2-4F2A-B5E2-BF94E956E183}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bussiness.Domain.Test", "Bussiness.Domain.Test\Bussiness.Domain.Test.csproj", "{A723B3B5-6C40-495D-88A7-8ADBBAB76710}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -83,12 +89,28 @@ Global
 		{DFAA3146-7008-4F54-B48B-013E80208376}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{DFAA3146-7008-4F54-B48B-013E80208376}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{DFAA3146-7008-4F54-B48B-013E80208376}.Release|Any CPU.Build.0 = Release|Any CPU
+		{9BDE4DA1-1F56-410D-A1A7-53EB3E8848B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9BDE4DA1-1F56-410D-A1A7-53EB3E8848B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9BDE4DA1-1F56-410D-A1A7-53EB3E8848B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9BDE4DA1-1F56-410D-A1A7-53EB3E8848B2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CEFD0FFD-FAF2-4F2A-B5E2-BF94E956E183}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CEFD0FFD-FAF2-4F2A-B5E2-BF94E956E183}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CEFD0FFD-FAF2-4F2A-B5E2-BF94E956E183}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CEFD0FFD-FAF2-4F2A-B5E2-BF94E956E183}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A723B3B5-6C40-495D-88A7-8ADBBAB76710}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A723B3B5-6C40-495D-88A7-8ADBBAB76710}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A723B3B5-6C40-495D-88A7-8ADBBAB76710}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A723B3B5-6C40-495D-88A7-8ADBBAB76710}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
 		{66017D12-2115-4DC9-B400-E5E57EE2D16E} = {4523E5A9-9492-49A2-8A1A-46080749D966}
+		{DFAA3146-7008-4F54-B48B-013E80208376} = {4523E5A9-9492-49A2-8A1A-46080749D966}
+		{9BDE4DA1-1F56-410D-A1A7-53EB3E8848B2} = {4523E5A9-9492-49A2-8A1A-46080749D966}
+		{CEFD0FFD-FAF2-4F2A-B5E2-BF94E956E183} = {4523E5A9-9492-49A2-8A1A-46080749D966}
+		{A723B3B5-6C40-495D-88A7-8ADBBAB76710} = {4523E5A9-9492-49A2-8A1A-46080749D966}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {2E43F5D5-31CD-4424-A538-4C716E71D9AF}

+ 25 - 0
MicroServices/Business/Bussiness.ApplicationTest/Bussiness.ApplicationTest.csproj

@@ -0,0 +1,25 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
+    <PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
+    <PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
+    <PackageReference Include="coverlet.collector" Version="3.1.2" />
+    <PackageReference Include="Shouldly" Version="4.1.0" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Buissness.UnitTest\Buissness.TestBase.csproj" />
+    <ProjectReference Include="..\Business.Application\Business.Application.csproj" />
+    <ProjectReference Include="..\Bussiness.Domain.Test\Bussiness.Domain.Test.csproj" />
+  </ItemGroup>
+
+</Project>

+ 25 - 0
MicroServices/Business/Bussiness.ApplicationTest/CoreApplicationTestBase.cs

@@ -0,0 +1,25 @@
+using System;
+using Buissness.TestBase;
+using Business.EntityFrameworkCore;
+
+namespace Bussiness.ApplicationTest
+{
+    public abstract class CoreApplicationTestBase : CoreTestBase<CoreApplicationTestModule> 
+    {
+        protected virtual void UsingDbContext(Action<BusinessDbContext> action)
+        {
+            using (var dbContext = GetRequiredService<BusinessDbContext>())
+            {
+                action.Invoke(dbContext);
+            }
+        }
+
+        protected virtual T UsingDbContext<T>(Func<BusinessDbContext, T> action)
+        {
+            using (var dbContext = GetRequiredService<BusinessDbContext>())
+            {
+                return action.Invoke(dbContext);
+            }
+        }
+    }
+}

+ 21 - 0
MicroServices/Business/Bussiness.ApplicationTest/CoreApplicationTestModule.cs

@@ -0,0 +1,21 @@
+using Buissness.TestBase;
+using Business;
+using Bussiness.EntityFrameworkCore.Test;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Modularity;
+
+namespace Bussiness.ApplicationTest
+{
+    [DependsOn(
+        typeof(BusinessApplicationModule),
+        typeof(CoreEntityFrameworkCoreTestModule),
+        typeof(CoreTestBaseModule)
+        )]
+    public class CoreApplicationTestModule : AbpModule
+    {
+        public override void ConfigureServices(ServiceConfigurationContext context)
+        {
+            context.Services.AddAlwaysAllowAuthorization();
+        }
+    }
+}

+ 30 - 0
MicroServices/Business/Bussiness.ApplicationTest/ResourceExamineManagement/ResourceExamineAppService_Tests.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Business.ResourceExamineManagement;
+using Business.ResourceExamineManagement.Dto;
+using Bussiness.ApplicationTest;
+using Shouldly;
+using Volo.Abp.Identity;
+using Xunit;
+
+namespace Bussiness.ApplicationTest.ResourceExamineManagement
+{
+    public class ResourceExamineAppService_Tests : CoreApplicationTestBase
+    {
+        private readonly IResourceExamineAppService _resourceExamineAppService;
+        public ResourceExamineAppService_Tests()
+        {
+            _resourceExamineAppService = GetRequiredService<IResourceExamineAppService>();
+        }
+
+        [Fact]
+        public async Task Should_ThrowExcetion()
+        {
+            var testInput = new SeorderentryDto { factoryId = 10201, sorderId = 111111, tenantId = 102 };
+            await Assert.ThrowsAsync<NotImplementedException>(async () => await _resourceExamineAppService.ReceiveResult(testInput));
+        }
+    }
+}

+ 28 - 0
MicroServices/Business/Bussiness.Domain.Test/Bussiness.Domain.Test.csproj

@@ -0,0 +1,28 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
+    <PackageReference Include="xunit" Version="2.4.2" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
+    <PackageReference Include="coverlet.collector" Version="3.1.2">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Bussiness.EntityFrameworkCore.Test\Bussiness.EntityFrameworkCore.Test.csproj" />
+  </ItemGroup>
+
+</Project>

+ 9 - 0
MicroServices/Business/Bussiness.Domain.Test/CoreDomainTestBase.cs

@@ -0,0 +1,9 @@
+using Buissness.TestBase;
+
+namespace Bussiness.Domain.Test
+{
+    public abstract class CoreDomainTestBase : CoreTestBase<CoreDomainTestModule> 
+    {
+
+    }
+}

+ 15 - 0
MicroServices/Business/Bussiness.Domain.Test/CoreDomainTestModule.cs

@@ -0,0 +1,15 @@
+using Bussiness.EntityFrameworkCore.Test;
+using Buissness.TestBase;
+using Volo.Abp.Modularity;
+
+namespace Bussiness.Domain.Test
+{
+    [DependsOn(
+        typeof(CoreEntityFrameworkCoreTestModule),
+        typeof(CoreTestBaseModule)
+        )]
+    public class CoreDomainTestModule : AbpModule
+    {
+
+    }
+}

+ 25 - 0
MicroServices/Business/Bussiness.Domain.Test/MES/IC/ic_substitute_Tests.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Bussiness.Model.MES.IC;
+using Bussiness.Model.SIM;
+using Shouldly;
+using Xunit;
+
+namespace Bussiness.Domain.Test
+{
+    public class ic_substitute_Tests
+    {
+        [Theory]
+        [InlineData("aaa")]
+        [InlineData("bbb")]
+        public void SetText(string text)
+        {
+            var comment = new ic_substitute { substitute_type = 1, substitute_code = "CCC" };
+            comment.substitute_code=text;
+            comment.substitute_code.ShouldBe(text);
+        }
+    }
+}

+ 10 - 0
MicroServices/Business/Bussiness.EntityFrameworkCore.Test/EntityFrameworkCore/CoreEntityFrameworkCoreTestBase.cs

@@ -0,0 +1,10 @@
+using Buissness.TestBase;
+using Volo.Abp;
+
+namespace Bussiness.EntityFrameworkCore.Test
+{
+    public abstract class CoreEntityFrameworkCoreTestBase : CoreTestBase<CoreEntityFrameworkCoreTestModule> 
+    {
+
+    }
+}

+ 64 - 0
MicroServices/Business/Bussiness.EntityFrameworkCore.Test/EntityFrameworkCore/CoreEntityFrameworkCoreTestModule.cs

@@ -0,0 +1,64 @@
+using Buissness.TestBase;
+using Business.EntityFrameworkCore;
+using Microsoft.Data.Sqlite;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp;
+using Volo.Abp.EntityFrameworkCore;
+using Volo.Abp.EntityFrameworkCore.Sqlite;
+using Volo.Abp.Modularity;
+
+namespace Bussiness.EntityFrameworkCore.Test
+{
+    [DependsOn(
+        typeof(BusinessEntityFrameworkCoreModule),
+        typeof(CoreTestBaseModule),
+        typeof(AbpEntityFrameworkCoreSqliteModule)
+        )]
+    public class CoreEntityFrameworkCoreTestModule : AbpModule
+    {
+        private SqliteConnection _sqliteConnection;
+
+        public override void ConfigureServices(ServiceConfigurationContext context)
+        {
+            ConfigureInMemorySqlite(context.Services);
+        }
+
+        private void ConfigureInMemorySqlite(IServiceCollection services)
+        {
+            _sqliteConnection = CreateDatabaseAndGetConnection();
+
+            services.Configure<AbpDbContextOptions>(options =>
+            {
+                options.Configure(context =>
+                {
+                    context.DbContextOptions.UseSqlite(_sqliteConnection);
+                });
+            });
+        }
+
+        public override void OnApplicationShutdown(ApplicationShutdownContext context)
+        {
+            _sqliteConnection.Dispose();
+        }
+
+        private static SqliteConnection CreateDatabaseAndGetConnection()
+        {
+            var connection = new SqliteConnection("Data Source=:memory:");
+            connection.Open();
+
+            var options = new DbContextOptionsBuilder<BusinessDbContext>()
+                .UseSqlite(connection)
+                .Options;
+
+            using (var context = new BusinessDbContext(options))
+            {
+                context.GetService<IRelationalDatabaseCreator>().CreateTables();
+            }
+
+            return connection;
+        }
+    }
+}

+ 13 - 0
MicroServices/Business/Bussiness.EntityFrameworkCore.Test/EntityFrameworkCore/MES/IC/sim_issue_typeRepository_Tests.cs

@@ -0,0 +1,13 @@
+using Buissness.TestBase;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Bussiness.EntityFrameworkCore.Test
+{
+    public class sim_issue_typeRepository_Tests : sim_issue_typeRepository_Tests<CoreEntityFrameworkCoreTestModule>
+    {
+    }
+}

+ 45 - 0
MicroServices/Business/Bussiness.EntityFrameworkCore.Test/EntityFrameworkCore/Samples/SampleRepositoryTests.cs

@@ -0,0 +1,45 @@
+using Bussiness.Model.SIM;
+using Microsoft.EntityFrameworkCore;
+using Shouldly;
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Identity;
+using Xunit;
+
+namespace Bussiness.EntityFrameworkCore.Test.Samples
+{
+    /* This is just an example test class.
+     * Normally, you don't test ABP framework code
+     * (like default AppUser repository IRepository<AppUser, Guid> here).
+     * Only test your custom repository methods.
+     */
+    public class SampleRepositoryTests : CoreEntityFrameworkCoreTestBase
+    {
+        private readonly IRepository<sim_base, long> _simbaseRepository;
+
+        public SampleRepositoryTests()
+        {
+            _simbaseRepository = GetRequiredService<IRepository<sim_base, long>>();
+        }
+
+        [Fact]
+        public async Task Should_Query_AppUser()
+        {
+            /* Need to manually start Unit Of Work because
+             * FirstOrDefaultAsync should be executed while db connection / context is available.
+             */
+            await WithUnitOfWorkAsync(async () =>
+            {
+                //Act
+                var simbase = await (await _simbaseRepository.GetQueryableAsync())
+                    .Where(u => u.rise_time>DateTime.MaxValue)
+                    .FirstOrDefaultAsync();
+
+                //Assert
+                simbase.ShouldNotBeNull();
+            });
+        }
+    }
+}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است