public void ProcessorCollection_Can_Have_No_Processors() { Processor containingProcessor = new MockNonGenericProcessor(); ProcessorCollection processorCollection = new ProcessorCollection(containingProcessor); Assert.AreEqual(0, processorCollection.Count, "ProcessorCollection.Count should have been zero."); }
public void UnBind_Does_Nothing_If_Arguments_Are_Not_Bound() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetOutputArguments(new ProcessorArgument("p2Out1", typeof(string))); MockNonGenericProcessor p3 = new MockNonGenericProcessor(); p3.SetInputArguments(new ProcessorArgument("p3In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1, p2, p3); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); bindings.BindArguments(p2.OutArguments[0], p3.InArguments[0]); Assert.AreEqual(0, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should not have been bound to any other arguments."); Assert.AreEqual(1, bindings.GetBoundToArguments(p2.OutArguments[0]).Count(), "Processor2 OutArgument1 should not have been bound to any other arguments."); Assert.AreEqual(1, bindings.GetBoundToArguments(p3.InArguments[0]).Count(), "Processor3 InArgument1 should not have been bound to any other arguments."); Assert.AreSame(p2.OutArguments[0], bindings.GetBoundToArguments(p3.InArguments[0]).Single(), "Processor3 InArgument1 should have been bound to Processor2 OutArgument1."); Assert.AreSame(p3.InArguments[0], bindings.GetBoundToArguments(p2.OutArguments[0]).Single(), "Processor2 OutArgument1 should have been bound to Processor3 InArgument1."); bindings.UnbindArguments(p1.OutArguments[0], p3.InArguments[0]); Assert.AreEqual(1, bindings.GetBoundToArguments(p2.OutArguments[0]).Count(), "Processor2 OutArgument1 should not have been bound to any other arguments."); Assert.AreEqual(1, bindings.GetBoundToArguments(p3.InArguments[0]).Count(), "Processor3 InArgument1 should not have been bound to any other arguments."); Assert.AreSame(p2.OutArguments[0], bindings.GetBoundToArguments(p3.InArguments[0]).Single(), "Processor3 InArgument1 should have been bound to Processor2 OutArgument1."); Assert.AreSame(p3.InArguments[0], bindings.GetBoundToArguments(p2.OutArguments[0]).Single(), "Processor2 OutArgument1 should have been bound to Processor3 InArgument1."); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var mvcBuilder = services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); var assemblies = Configuration.GetSection("ControllerAssemblies")?.Get <List <string> >() .Distinct() .Select(a => Assembly.LoadFile($"{AppDomain.CurrentDomain.BaseDirectory}\\{a}")) .ToList(); if (assemblies != null) { foreach (var assembly in assemblies) { mvcBuilder = mvcBuilder.AddApplicationPart(assembly); } } mvcBuilder = mvcBuilder.AddControllersAsServices(); ProcessorCollection processorCollection = new ProcessorCollection(services.BuildServiceProvider()); processorCollection.Initialize(Configuration); services.AddSingleton <IProcessorCollection>(processorCollection); var svc = services.BuildServiceProvider().GetServices <IProcessorCollection>(); }
public void Bind_Unbind_Bind_Is_Equivalent_To_Bind() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetInputArguments(new ProcessorArgument("p2In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1, p2); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); bindings.BindArguments(p1.OutArguments[0], p2.InArguments[0]); Assert.AreEqual(1, bindings.GetBoundToArguments(p2.InArguments[0]).Count(), "Processor2 InArgument1 should have been bound to one other argument."); Assert.AreEqual(1, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should have been bound to one other argument."); Assert.AreSame(p1.OutArguments[0], bindings.GetBoundToArguments(p2.InArguments[0]).Single(), "Processor2 InArgument1 should have been bound to Processor1 OutArgument1."); Assert.AreSame(p2.InArguments[0], bindings.GetBoundToArguments(p1.OutArguments[0]).Single(), "Processor1 OutArgument1 should have been bound to Processor2 InArgument1."); bindings.UnbindArguments(p1.OutArguments[0], p2.InArguments[0]); Assert.AreEqual(0, bindings.GetBoundToArguments(p2.InArguments[0]).Count(), "Processor2 InArgument1 should not have been bound to any other arguments."); Assert.AreEqual(0, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should not have been bound to any other arguments."); bindings.BindArguments(p1.OutArguments[0], p2.InArguments[0]); Assert.AreEqual(1, bindings.GetBoundToArguments(p2.InArguments[0]).Count(), "Processor2 InArgument1 should have been bound to one other argument."); Assert.AreEqual(1, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should have been bound to one other argument."); Assert.AreSame(p1.OutArguments[0], bindings.GetBoundToArguments(p2.InArguments[0]).Single(), "Processor2 InArgument1 should have been bound to Processor1 OutArgument1."); Assert.AreSame(p2.InArguments[0], bindings.GetBoundToArguments(p1.OutArguments[0]).Single(), "Processor1 OutArgument1 should have been bound to Processor2 InArgument1."); }
public void Bind_Can_Bind_One_OutArgument_Multiple_Times() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetInputArguments(new ProcessorArgument("p2In1", typeof(string))); MockNonGenericProcessor p3 = new MockNonGenericProcessor(); p3.SetInputArguments(new ProcessorArgument("p3In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1, p2, p3); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); bindings.BindArguments(p1.OutArguments[0], p2.InArguments[0]); bindings.BindArguments(p1.OutArguments[0], p3.InArguments[0]); Assert.AreEqual(2, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should have been bound to two other arguments."); Assert.AreSame(p2.InArguments[0], bindings.GetBoundToArguments(p1.OutArguments[0]).First(), "Processor1 OutArgument1 should have been bound to Processor2 InArgument1."); Assert.AreSame(p3.InArguments[0], bindings.GetBoundToArguments(p1.OutArguments[0]).Skip(1).First(), "Processor1 OutArgument1 should have been bound to Processor3 InArgument1."); Assert.AreSame(p1.OutArguments[0], bindings.GetBoundToArguments(p2.InArguments[0]).Single(), "Processor2 InArgument1 should have been bound to Processor1 OutArgument1."); Assert.AreSame(p1.OutArguments[0], bindings.GetBoundToArguments(p3.InArguments[0]).Single(), "Processor3 InArgument1 should have been bound to Processor1 OutArgument1."); }
public PipelineBindingCollection(ProcessorCollection processors) { Debug.Assert(processors != null, "The 'processors' parameter should not be null."); this.processors = processors; this.bindings = new Dictionary<ProcessorArgument, List<ProcessorArgument>>(); }
public void ProcessorCollection_Cannot_Be_Created_With_The_ContainingProcessor_In_The_Processor_Collection() { Processor processor1 = new MockNonGenericProcessor(); Processor processor2 = new MockNonGenericProcessor(); Processor containingProcessor = new MockNonGenericProcessor(); ExceptionAssert.ThrowsInvalidOperation( "Creating the ProcessorCollection with the containing processor in the list of processors should throw.", () => { ProcessorCollection processorCollection = new ProcessorCollection(containingProcessor, processor1, processor2, containingProcessor); }); }
public void ProcessorCollection_Cannot_Be_Created_With_A_Processor_Added_Twice() { Processor processor1 = new MockNonGenericProcessor(); Processor processor2 = new MockNonGenericProcessor(); Processor containingProcessor = new MockNonGenericProcessor(); ExceptionAssert.ThrowsInvalidOperation( "Creating the ProcessorCollection with the processor2 in the list twice should throw.", () => { ProcessorCollection processorCollection = new ProcessorCollection(containingProcessor, processor1, processor2, processor1); }); }
public void ProcessorCollection_With_Null_ContainingProcessor_Throws() { Processor processor1 = new MockNonGenericProcessor(); Processor processor2 = new MockNonGenericProcessor(); ExceptionAssert.ThrowsArgumentNull( "Creating the ProcessorCollection with a null container processor should throw.", "containerProcessor", () => { ProcessorCollection processorCollection = new ProcessorCollection(null, processor1, processor2, processor1); }); }
public void ProcessorCollection_Cannot_Be_Created_With_A_Null_Processor() { Processor processor1 = new MockNonGenericProcessor(); Processor processor2 = new MockNonGenericProcessor(); Processor containingProcessor = new MockNonGenericProcessor(); ExceptionAssert.ThrowsArgumentNull( "Creating the ProcessorCollection with a null processor in the list should throw.", string.Empty, () => { ProcessorCollection processorCollection = new ProcessorCollection(containingProcessor, processor1, null, processor2); }); }
public void ProcessorCollection_With_Null_Processors_Throws() { Processor processor1 = new MockNonGenericProcessor(); Processor processor2 = new MockNonGenericProcessor(); Processor containingProcessor = new MockNonGenericProcessor(); ExceptionAssert.ThrowsArgumentNull( "Creating the ProcessorCollection with a null list of processors should throw.", "list", () => { ProcessorCollection processorCollection = new ProcessorCollection(containingProcessor, null); }); }
public void Unbind_With_In_Argument_Not_Attached_To_Processors_Throws() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); ExceptionAssert.ThrowsInvalidOperation( "Unbind should have thrown because the in arugment does not belong to a processor", () => { bindings.UnbindArguments(p1.OutArguments[0], new ProcessorArgument("someName", typeof(string))); }); }
public void Unbind_With_Arguments_On_The_Same_Processor_Throws() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); p1.SetInputArguments(new ProcessorArgument("p1In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); ExceptionAssert.ThrowsInvalidOperation( "Unbind should have thrown because the in arugment and out argument belong to the same processor", () => { bindings.UnbindArguments(p1.OutArguments[0], p1.InArguments[0]); }); }
/// <summary> /// Gets the runtime object. /// </summary> /// <returns>The processor collection runtime object <see cref="ProcessorCollection"/>.</returns> public new ProcessorCollection GetRuntimeObject() { ProcessorCollection processors = new ProcessorCollection(); // bool flag = false; foreach (ProcessorElement element in this.Processors) { /* //if (!flag && !element._isAddedByDefault) { // new System.Security.Permissions.SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand(); // flag = true; //} */ processors.Add(element.GetRuntimeObject()); } return processors; }
public void Unbind_With_Out_Argument_On_Processors_Not_In_A_ProcessorCollection_Throws() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetInputArguments(new ProcessorArgument("p1In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetOutputArguments(new ProcessorArgument("p2Out1", typeof(string))); ExceptionAssert.ThrowsInvalidOperation( "Unbind should have thrown because the out arugment processor does not belong to any processor collection", () => { bindings.UnbindArguments(p2.OutArguments[0], p1.InArguments[0]); }); }
public void Bind_With_OutArgument_Type_Assignable_To_InArgument_Type() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(Uri))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetInputArguments(new ProcessorArgument("p2In1", typeof(object))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1, p2); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); bindings.BindArguments(p1.OutArguments[0], p2.InArguments[0]); Assert.AreEqual(1, bindings.GetBoundToArguments(p2.InArguments[0]).Count(), "Processor2 InArgument1 should have been bound to one other argument."); Assert.AreEqual(1, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should have been bound to one other argument."); Assert.AreSame(p1.OutArguments[0], bindings.GetBoundToArguments(p2.InArguments[0]).First(), "Processor2 InArgument1 should have been bound to Processor1 OutArgument1."); Assert.AreSame(p2.InArguments[0], bindings.GetBoundToArguments(p1.OutArguments[0]).First(), "Processor1 OutArgument1 should have been bound to Processor2 InArgument1."); }
public void Unbind_With_OutArgument_Type_Not_Assignable_To_InArgument_Type_Throws() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(object))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetInputArguments(new ProcessorArgument("p2In1", typeof(Uri))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1, p2); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); ExceptionAssert.ThrowsInvalidOperation( "Unbind should have thrown because the out arugment is not assignable to the in argument.", () => { bindings.UnbindArguments(p1.OutArguments[0], p2.InArguments[0]); }); }
public void Unbind_With_OutArgument_That_Is_Not_Out_Direction_Throws() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetInputArguments(new ProcessorArgument("p1In1", typeof(string))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetInputArguments(new ProcessorArgument("p2In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1, p2); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); ExceptionAssert.ThrowsInvalidOperation( "Unbind should have thrown because the out arugment is not in the out direction.", () => { bindings.UnbindArguments(p1.InArguments[0], p2.InArguments[0]); }); }
public void Unbind_With_In_Arguments_On_Processors_Not_In_The_Same_ProcessorCollection_Throws() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetInputArguments(new ProcessorArgument("p2In1", typeof(string))); ProcessorCollection otherCollection = new ProcessorCollection(new MockNonGenericProcessor(), p2); ExceptionAssert.ThrowsInvalidOperation( "Unbind should have thrown because the in arugment processor belongs to a different processor collection", () => { bindings.UnbindArguments(p1.OutArguments[0], p2.InArguments[0]); }); }
public void Unbind_With_InArgument_Processor_Before_OutArgument_Processor_Throws() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetInputArguments(new ProcessorArgument("p2In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p2, p1); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); ExceptionAssert.ThrowsInvalidOperation( "Unbind should have thrown because processor 1 comes after processor 2.", () => { bindings.UnbindArguments(p1.OutArguments[0], p2.InArguments[0]); }); }
public void GetBoundToArguments_Never_Returns_Null() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); ProcessorArgument arg2 = new ProcessorArgument("arg1", typeof(string)); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); IEnumerable <ProcessorArgument> boundArguments = bindings.GetBoundToArguments(p1.OutArguments[0]); Assert.IsNotNull(boundArguments, "ProcessorBindingCollection.GetBoundArguments should never return null."); Assert.AreEqual(0, boundArguments.Count(), "ProcessorBindingCollection.GetBoundArguments should have returned an empty collection."); boundArguments = bindings.GetBoundToArguments(arg2); Assert.IsNotNull(boundArguments, "ProcessorBindingCollection.GetBoundArguments should never return null."); Assert.AreEqual(0, boundArguments.Count(), "ProcessorBindingCollection.GetBoundArguments should have returned an empty collection."); }
public void Bind_Is_Idempotent() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetInputArguments(new ProcessorArgument("p2In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1, p2); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); bindings.BindArguments(p1.OutArguments[0], p2.InArguments[0]); Assert.AreEqual(1, bindings.GetBoundToArguments(p2.InArguments[0]).Count(), "Processor2 InArgument1 should have been bound to one other argument."); Assert.AreEqual(1, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should have been bound to one other argument."); Assert.AreSame(p1.OutArguments[0], bindings.GetBoundToArguments(p2.InArguments[0]).First(), "Processor2 InArgument1 should have been bound to Processor1 OutArgument1."); Assert.AreSame(p2.InArguments[0], bindings.GetBoundToArguments(p1.OutArguments[0]).First(), "Processor1 OutArgument1 should have been bound to Processor2 InArgument1."); bindings.BindArguments(p1.OutArguments[0], p2.InArguments[0]); Assert.AreEqual(1, bindings.GetBoundToArguments(p2.InArguments[0]).Count(), "Processor2 InArgument1 should have been bound to one other argument."); Assert.AreEqual(1, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should have been bound to one other argument."); Assert.AreSame(p1.OutArguments[0], bindings.GetBoundToArguments(p2.InArguments[0]).First(), "Processor2 InArgument1 should have been bound to Processor1 OutArgument1."); Assert.AreSame(p2.InArguments[0], bindings.GetBoundToArguments(p1.OutArguments[0]).First(), "Processor1 OutArgument1 should have been bound to Processor2 InArgument1."); }
/// <summary> /// Inicializē jauno <see cref="ProcessorManager"/> klases instanci. /// </summary> public ProcessorManager() { this._processors = new ProcessorCollection(); }
public void Unbind_With_Out_Argument_Not_Attached_To_Processors_Throws() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetInputArguments(new ProcessorArgument("p1In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); ExceptionAssert.ThrowsInvalidOperation( "Unbind should have thrown because the out arugment does not belong to a processor", () => { bindings.UnbindArguments(new ProcessorArgument("someName", typeof(string)), p1.InArguments[0]); }); }
public void UnBind_Removes_The_Binding_If_Arguments_Are_Bound() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetInputArguments(new ProcessorArgument("p2In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1, p2); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); bindings.BindArguments(p1.OutArguments[0], p2.InArguments[0]); Assert.AreEqual(1, bindings.GetBoundToArguments(p2.InArguments[0]).Count(), "Processor2 InArgument1 should have been bound to one other argument."); Assert.AreEqual(1, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should have been bound to one other argument."); Assert.AreSame(p1.OutArguments[0], bindings.GetBoundToArguments(p2.InArguments[0]).Single(), "Processor2 InArgument1 should have been bound to Processor1 OutArgument1."); Assert.AreSame(p2.InArguments[0], bindings.GetBoundToArguments(p1.OutArguments[0]).Single(), "Processor1 OutArgument1 should have been bound to Processor2 InArgument1."); bindings.UnbindArguments(p1.OutArguments[0], p2.InArguments[0]); Assert.AreEqual(0, bindings.GetBoundToArguments(p2.InArguments[0]).Count(), "Processor2 InArgument1 should not have been bound to any other arguments."); Assert.AreEqual(0, bindings.GetBoundToArguments(p1.OutArguments[0]).Count(), "Processor1 OutArgument1 should not have been bound to any other arguments."); }
public void UnBind_Does_Not_Remove_Other_Bindings_On_An_InArgument() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); MockNonGenericProcessor p2 = new MockNonGenericProcessor(); p2.SetOutputArguments(new ProcessorArgument("p2Out1", typeof(string))); MockNonGenericProcessor p3 = new MockNonGenericProcessor(); p3.SetInputArguments(new ProcessorArgument("p3In1", typeof(string))); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1, p2, p3); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); bindings.BindArguments(p1.OutArguments[0], p3.InArguments[0]); bindings.BindArguments(p2.OutArguments[0], p3.InArguments[0]); bindings.UnbindArguments(p1.OutArguments[0], p3.InArguments[0]); Assert.AreEqual(1, bindings.GetBoundToArguments(p2.OutArguments[0]).Count(), "Processor2 OutArgument1 should not have been bound to any other arguments."); Assert.AreEqual(1, bindings.GetBoundToArguments(p3.InArguments[0]).Count(), "Processor3 InArgument1 should not have been bound to any other arguments."); Assert.AreSame(p2.OutArguments[0], bindings.GetBoundToArguments(p3.InArguments[0]).Single(), "Processor3 InArgument1 should have been bound to Processor2 OutArgument1."); Assert.AreSame(p3.InArguments[0], bindings.GetBoundToArguments(p2.OutArguments[0]).Single(), "Processor2 OutArgument1 should have been bound to Processor3 InArgument1."); }
public void GetBoundToArguments_Never_Returns_Null() { MockNonGenericProcessor p1 = new MockNonGenericProcessor(); p1.SetOutputArguments(new ProcessorArgument("p1Out1", typeof(string))); ProcessorArgument arg2 = new ProcessorArgument("arg1", typeof(string)); ProcessorCollection collection = new ProcessorCollection(new MockNonGenericProcessor(), p1); PipelineBindingCollection bindings = new PipelineBindingCollection(collection); IEnumerable<ProcessorArgument> boundArguments = bindings.GetBoundToArguments(p1.OutArguments[0]); Assert.IsNotNull(boundArguments, "ProcessorBindingCollection.GetBoundArguments should never return null."); Assert.AreEqual(0, boundArguments.Count(), "ProcessorBindingCollection.GetBoundArguments should have returned an empty collection."); boundArguments = bindings.GetBoundToArguments(arg2); Assert.IsNotNull(boundArguments, "ProcessorBindingCollection.GetBoundArguments should never return null."); Assert.AreEqual(0, boundArguments.Count(), "ProcessorBindingCollection.GetBoundArguments should have returned an empty collection."); }
//- ~LoadProcessorData -// internal static void LoadProcessorData(WebDomainData data, ProcessorCollection collection) { var readerWriterLockSlim = new ReaderWriterLockSlim(); List<ProcessorElement> elementList = collection.ToList(); foreach (ProcessorElement processor in elementList) { if (!processor.Enabled) { continue; } LoadSingleProcessorData(data, processor.ProcessorType, processor.GetParameterArray(), String.Empty); } foreach (ProcessorData processor in data.ProcessorDataList) { LoadSingleProcessorData(data, processor.ProcessorType, processor.ParameterArray, processor.Source); } //+ data.InitProcessorDataList.OriginalCount = data.InitProcessorDataList.Count; data.SelectionProcessorDataList.OriginalCount = data.SelectionProcessorDataList.Count; data.OverrideProcessorDataList.OriginalCount = data.OverrideProcessorDataList.Count; data.StateProcessorDataList.OriginalCount = data.StateProcessorDataList.Count; data.ErrorProcessorDataList.OriginalCount = data.ErrorProcessorDataList.Count; }