/// <summary> /// /// </summary> /// <typeparam name="TFlowTypesEnum"></typeparam> /// <typeparam name="TFlowsController"></typeparam> /// <param name="builder"></param> /// <param name="services"></param> /// <param name="flowsAssembly"></param> /// <param name="flowsRootNamespace"></param> /// <param name="flowsRootPath"></param> /// <returns></returns> public static IMvcBuilder AddUiFlows <TFlowsController>(this IMvcBuilder builder, IServiceCollection services, Assembly flowsAssembly, string flowsRootNamespace, string flowsRootPath) where TFlowsController : IUiFlowController { var flowsRegistry = new FlowsRegistry(flowsAssembly, flowsRootNamespace, flowsRootPath); UiFlowsMvcModule.Registry = flowsRegistry; services.Configure <RazorViewEngineOptions>(o => { o.ViewLocationExpanders.Add(new UiFlowViewLocationExpander(flowsRegistry)); }); services.Configure <MvcRazorRuntimeCompilationOptions>(opts => { var fileProvider = new EmbeddedFileProvider(typeof(AppSetupExtensions).GetTypeInfo().Assembly); opts.FileProviders.Add(fileProvider); }); ; builder.AddMvcOptions(o => { o.Conventions.Add(new UiFlowControllerRouteConvention <TFlowsController>(flowsRegistry)); o.ModelBinderProviders.Insert(0, new UiFlowStepDataModelBinderProvider()); }); return(builder.ConfigureApplicationPartManager(m => m.FeatureProviders.Add(new UiFlowControllerFeatureProvider()))); }
public void CanResolveUrlPath() { var actual = new FlowsRegistry(typeof(InitialScreen).Assembly, "S3.App.Flows.AppFlows", "/Flows/AppFlows") .GetByName("bLuEflow"); Assert.AreEqual("/Flows/AppFlows/BlueFlow".ToLowerInvariant(), actual.UrlPath.ToLowerInvariant()); }
public void CanScanFlows() { var expected = new[] { "BlueFlow", "GreenFlow", "ContainersFlow", "ContainersFlow2", "ContainersFlow3", "ContainersFlow4", "ModelTesterFlow", "StartFailure", "MetadataTestFlow", "ComponentsFlow" }.Select(_ => _.ToLowerInvariant()).ToArray(); var actual = new FlowsRegistry(typeof(InitialScreen).Assembly, "S3.App.Flows.AppFlows", "/Flows/AppFlows") .AllFlows .Select(x => x.Name); CollectionAssert.AreEquivalent(expected, actual); }
public string CanResolveFlowByType(Type type) { var sut = new FlowsRegistry(typeof(InitialScreen).Assembly, "S3.App.Flows.AppFlows", "/Flows/AppFlows"); return(sut.GetByType(type, false)?.Name); }