Beispiel #1
0
        public static void RegisterProcessor(this IUnityContainer container, FileProcessorEndpoint endpoint)
        {
            endpoint.Validate();

            // Register the endpoint instance under the name, needed for the processor
            container.RegisterInstance(endpoint.Name, endpoint);

            // create file processor configurator instance and invoke
            var typeResolver           = container.Resolve <ITypeResolver>();
            var fileProcessorRegistrar = typeResolver.Resolve <IFileProcessorRegistrar>(endpoint.ProcessorConfigurator);

            fileProcessorRegistrar.Register(container, endpoint);
        }
Beispiel #2
0
        public void TestValidate(string name, string processConfigurator, string inProgressPath, bool expectException)
        {
            var failSuffix = name + ", " + processConfigurator + ", " + inProgressPath;

            try
            {
                var endpoint = new FileProcessorEndpoint {
                    Name = name, ProcessorConfigurator = processConfigurator, InProgressPath = inProgressPath
                };
                var candidate = endpoint.Validate();
                if (expectException)
                {
                    Assert.Fail("expected Exception was not thrown : " + failSuffix);
                }
                Assert.IsTrue(candidate);
            }
            catch (NotSupportedException)
            {
                if (!expectException)
                {
                    Assert.Fail("Exception was thrown but not expected : " + failSuffix);
                }
            }
        }