public DefaultBehaviorTests(IntegrationTestContext <TestableStartup <DefaultBehaviorDbContext>, DefaultBehaviorDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.UseRelativeLinks = true; }
public FilterTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.EnableLegacyFilterNotation = false; }
public CreateResourceWithToOneRelationshipTests(IntegrationTestContext <TestableStartup <WriteDbContext>, WriteDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.AllowClientGeneratedIds = true; }
public TopLevelCountTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = true; }
public FilterDataTypeTests(IntegrationTestContext <TestableStartup> testContext) { _testContext = testContext; var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.EnableLegacyFilterNotation = false; }
public UpdateResourceTests(IntegrationTestContext <TestableStartup <WriteDbContext>, WriteDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.UseRelativeLinks = false; options.AllowClientGeneratedIds = false; }
public RequestMetaTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesBeforeStartup(services => { services.AddScoped <IRequestMeta, TestRequestMeta>(); }); }
public EmptyGuidAsKeyTests(IntegrationTestContext <TestableStartup <ZeroKeyDbContext>, ZeroKeyDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.UseRelativeLinks = true; options.AllowClientGeneratedIds = true; }
public void 获取已完成流程节点(string bpmnFile) { string xml = IntegrationTestContext.ReadBpmn(bpmnFile); ICommandExecutor commandExecutor = (processEngine.ProcessEngineConfiguration as ProcessEngineConfigurationImpl).CommandExecutor; Authentication.AuthenticatedUser = new InProcessWorkflowEngine.TestUser() { Id = "评审员", FullName = "评审员", TenantId = context.TenantId }; IDeploymentBuilder builder = processEngine.RepositoryService.CreateDeployment() .Name(Path.GetFileNameWithoutExtension(bpmnFile)) .TenantId(context.TenantId) .AddString(bpmnFile, xml) .EnableDuplicateFiltering() .TenantId(context.TenantId); IDeployment deploy = commandExecutor.Execute(new DeployCmd(builder)); IProcessDefinition definition = processEngine.RepositoryService.CreateProcessDefinitionQuery() .SetDeploymentId(deploy.Id) .SetProcessDefinitionTenantId(context.TenantId) .SetLatestVersion() .SingleResult(); BpmnModel model = commandExecutor.Execute(new GetBpmnModelCmd(definition.Id)); IProcessInstance processInstance = commandExecutor.Execute(new StartProcessInstanceCmd(definition.Id, null)); IList <ITask> tasks = processEngine.TaskService.GetMyTasks("用户1"); ITaskEntity task = tasks[0] as ITaskEntity; IExecutionEntity execution = commandExecutor.Execute(new GetExecutionByIdCmd(task.ExecutionId)); processEngine.TaskService.Complete(task.Id, new Dictionary <string, object> { { "流程变量", "变量值" } }); var list = commandExecutor.Execute(new GetCompletedTaskModelsCmd(task.ProcessInstanceId, true)); Assert.Contains(model.MainProcess.FlowElements, x => list.Any(y => x.Id == y.Id)); tasks = processEngine.TaskService.GetMyTasks("用户2"); task = tasks[0] as ITaskEntity; processEngine.TaskService.Complete(task.Id, new Dictionary <string, object> { { "流程变量", "变量值" } }); list = commandExecutor.Execute(new GetCompletedTaskModelsCmd(task.ProcessInstanceId, true)); Assert.Contains(model.MainProcess.FlowElements, x => list.Any(y => x.Id == y.Id)); }
public EagerLoadingTests(IntegrationTestContext <TestableStartup <EagerLoadingDbContext>, EagerLoadingDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddResourceRepository <BuildingRepository>(); }); }
public async Task Start_完成用户注册路径_女(string bpmnFile) { var ex = await Record.ExceptionAsync(async() => { IProcessDefinitionDeployerController pdc = ctx.CreateWorkflowHttpProxy().GetDefinitionDeployerClient(); string formKey = Guid.NewGuid().ToString(); string xml = IntegrationTestContext.ReadBpmn(bpmnFile); XDocument doc = XDocument.Load(new MemoryStream(Encoding.UTF8.GetBytes(xml)), LoadOptions.PreserveWhitespace); var elem = doc.Descendants(XName.Get("startEvent", BpmnXMLConstants.BPMN2_NAMESPACE)).First(); elem.Attribute(XName.Get("formKey", BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE)).Value = formKey; Deployment deployment = await pdc.Deploy(new ProcessDefinitionDeployer { BpmnXML = doc.ToString(), Name = Path.GetFileNameWithoutExtension(bpmnFile), TenantId = ctx.TenantId }).ConfigureAwait(false); string uid = Guid.NewGuid().ToString(); StartProcessInstanceCmd cmd = new StartProcessInstanceCmd() { StartForm = formKey, Variables = new Dictionary <string, object> { { "User", new string[] { uid } } }, TenantId = ctx.TenantId }; ProcessInstance[] instances = AsyncHelper.RunSync <ProcessInstance[]>(() => client.Start(new StartProcessInstanceCmd[] { cmd })); Assert.NotNull(instances); Assert.True(instances.Count() > 0); ITaskController tc = ctx.CreateWorkflowHttpProxy().GetTaskClient(); Resources <TaskModel> myTasks = null; while (true) { myTasks = await Complete(tc, uid, new Dictionary <string, object> { { "gender", 2 } }).ConfigureAwait(false); if (myTasks == null || myTasks.TotalCount <= 0) { break; } } }).ConfigureAwait(false); Assert.Null(ex); }
public LinksWithoutNamespaceTests(IntegrationTestContext <NoNamespaceStartup, AppDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { var part = new AssemblyPart(typeof(EmptyStartup).Assembly); services.AddMvcCore().ConfigureApplicationPartManager(apm => apm.ApplicationParts.Add(part)); }); }
public void InitializeTest() { Database.SetInitializer(new DropCreateDatabaseAlways<IntegrationTestContext>()); IntegrationTestContext testContext = new IntegrationTestContext(); testContext.Database.Initialize(true); testRepo = new EntityFrameworkGenericRepository<IntegrationTestContext>(testContext); teamStorageManager = new TeamStorageManager(testRepo); userManager = new UserManager(teamStorageManager); }
public PaginationRangeTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.DefaultPageSize = new PageSize(_defaultPageSize); options.MaximumPageSize = null; options.MaximumPageNumber = null; }
public SortTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; _articleFaker = new Faker <Article>() .RuleFor(a => a.Caption, f => f.Random.AlphaNumeric(10)); _authorFaker = new Faker <Author>() .RuleFor(a => a.LastName, f => f.Random.Words(2)); }
public RangeValidationWithMaximumTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.DefaultPageSize = new PageSize(5); options.MaximumPageSize = new PageSize(_maximumPageSize); options.MaximumPageNumber = new PageNumber(_maximumPageNumber); }
public SoftDeletionTests(IntegrationTestContext <TestableStartup <SoftDeletionDbContext>, SoftDeletionDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped <IResourceDefinition <Company>, SoftDeletionResourceDefinition <Company> >(); services.AddScoped <IResourceDefinition <Department>, SoftDeletionResourceDefinition <Department> >(); }); }
public ResourceDefinitionQueryCallbackTests(IntegrationTestContext <TestableStartup <CallableDbContext>, CallableDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped <ResourceDefinition <CallableResource>, CallableResourceDefinition>(); services.AddSingleton <IUserRolesService, FakeUserRolesService>(); }); }
public PaginationWithoutTotalCountTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = false; options.DefaultPageSize = new PageSize(_defaultPageSize); options.AllowUnknownQueryStringParameters = true; }
public AtomicOperationsFixture() { TestContext = new IntegrationTestContext <TestableStartup, OperationsDbContext> { StartMongoDbInSingleNodeReplicaSetMode = true }; TestContext.UseController <OperationsController>(); TestContext.ConfigureServicesAfterStartup(services => services.AddSingleton <ResourceDefinitionHitCounter>()); }
public RelativeLinksWithNamespaceTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.Namespace = "api/v1"; options.UseRelativeLinks = true; options.DefaultPageSize = new PageSize(10); options.IncludeTotalResourceCount = true; }
public PaginationTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.DefaultPageSize = new PageSize(5); options.MaximumPageSize = null; options.MaximumPageNumber = null; options.DisableTopPagination = false; options.DisableChildrenPagination = false; }
public ResponseMetaTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddSingleton <IResponseMeta, TestResponseMeta>(); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = false; }
public ResourceDefinitionQueryCallbackTests(IntegrationTestContext <TestableStartup> testContext) { _testContext = testContext; _testContext.ConfigureServicesAfterStartup(services => { services.AddSingleton <IUserRolesService, FakeUserRolesService>(); }); var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.IncludeTotalResourceCount = true; }
public CompositeKeyTests(IntegrationTestContext <TestableStartup <CompositeDbContext>, CompositeDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddResourceRepository <CarRepository>(); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.AllowClientGeneratedIds = true; }
public KebabCaseFormatterTests(IntegrationTestContext <KebabCaseStartup, AppDbContext> testContext) { _testContext = testContext; _faker = new Faker <KebabCasedModel>() .RuleFor(m => m.CompoundAttr, f => f.Lorem.Sentence()); testContext.ConfigureServicesAfterStartup(services => { var part = new AssemblyPart(typeof(EmptyStartup).Assembly); services.AddMvcCore().ConfigureApplicationPartManager(apm => apm.ApplicationParts.Add(part)); }); }
public IncludeTests(IntegrationTestContext <Startup, AppDbContext> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddScoped <IResourceService <Article>, JsonApiResourceService <Article> >(); }); var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService <IJsonApiOptions>(); options.MaximumIncludeDepth = null; }
public SparseFieldSetTests(IntegrationTestContext <Startup> testContext) { _testContext = testContext; testContext.ConfigureServicesAfterStartup(services => { services.AddSingleton <ResourceCaptureStore>(); services.AddResourceRepository <ResultCapturingRepository <Blog> >(); services.AddResourceRepository <ResultCapturingRepository <Article> >(); services.AddResourceRepository <ResultCapturingRepository <Author> >(); services.AddResourceRepository <ResultCapturingRepository <TodoItem> >(); }); }
public Deployment Deploy(string bpmnFile) { string xml = IntegrationTestContext.ReadBpmn(bpmnFile); ProcessDefinitionDeployer deployer = new ProcessDefinitionDeployer { Name = Path.GetFileNameWithoutExtension(bpmnFile), BpmnXML = xml, TenantId = ctx.TenantId, EnableDuplicateFiltering = false }; Deployment deployment = AsyncHelper.RunSync <Deployment>(() => client.Deploy(deployer)); return(deployment); }
public async void 使用表单启动流程(string bpmnFile) { var ex = await Record.ExceptionAsync(async() => { string formKey = Guid.NewGuid().ToString(); IProcessDefinitionDeployerController deployerClient = ctx.CreateWorkflowHttpProxy().GetDefinitionDeployerClient(); string depBpmnName = Path.GetFileNameWithoutExtension(bpmnFile); string xml = IntegrationTestContext.ReadBpmn(bpmnFile); XDocument doc = XDocument.Load(new MemoryStream(Encoding.UTF8.GetBytes(xml)), LoadOptions.PreserveWhitespace); XElement elem = doc.Descendants(XName.Get("startEvent", BpmnXMLConstants.BPMN2_NAMESPACE)).First(); XAttribute attr = elem.Attribute(XName.Get("formKey", BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE)); attr.Value = formKey; xml = doc.ToString(); ProcessDefinitionDeployer deployer = new ProcessDefinitionDeployer { Name = depBpmnName, BpmnXML = xml, TenantId = ctx.TenantId, EnableDuplicateFiltering = false }; Deployment deployment = await deployerClient.Deploy(deployer).ConfigureAwait(false); ProcessInstance[] insts = await client.Start(new StartProcessInstanceCmd[] { new StartProcessInstanceCmd { StartForm = formKey, TenantId = ctx.TenantId } }).ConfigureAwait(false); Assert.Single(insts); }).ConfigureAwait(false); Assert.Null(ex); }
internal static HttpRequestMessage BuildRequest( TestSuiteContext testSuiteContext, IntegrationTestContext integrationTestContext, string[] scenarioName) { var request = testSuiteContext.LoadScenario(scenarioName).Request; // Redirect the request to the AWS S3 bucket request.RequestUri = request.RequestUri .ToString() .Replace("https://example.amazonaws.com", integrationTestContext.S3BucketUrl) .ToUri(); // The "Host" header is now invalid since we redirected the request to the AWS S3 // bucket. Lets remove the header and have the signature implementation re-add it // correctly. request.Headers.Remove("Host"); return(request); }