public void when_invalid_endpoint_type_is_provided_via_configuration_it_should_blow_up()
            {
                Sut = new EndpointTypeDeterminer(AssemblyScanner.GetScannableAssemblies(),
                                                 () => "I am an invalid type name");

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;
            }
            public void when_endpoint_type_is_provided_via_configuration_it_should_have_first_priority()
            {
                Sut = new EndpointTypeDeterminer(AssemblyScanner.GetScannableAssemblies(),
                                                 () => ConfigurationManager.AppSettings["EndpointConfigurationType"]);

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;

                Assert.AreEqual(EndpointTypeDefinedInConfigurationFile, RetrievedEndpointType);
            }
Beispiel #3
0
        public void when_endpoint_type_is_provided_via_configuration_it_should_have_first_priority()
        {
            var EndpointTypeDefinedInConfigurationFile = typeof(MyEndpointConfig);
            var EndpointTypeDeterminer = new EndpointTypeDeterminer(new AssemblyScanner(),
                                                                    () => ConfigurationManager.AppSettings["EndpointConfigurationType"]);

            var RetrievedEndpointType = EndpointTypeDeterminer.GetEndpointConfigurationType().Type;

            Assert.AreEqual(EndpointTypeDefinedInConfigurationFile, RetrievedEndpointType);
        }
Beispiel #4
0
        public void when_multiple_endpoint_types_found_via_assembly_scanning_it_should_blow_up()
        {
            var endpointTypeDeterminer = new EndpointTypeDeterminer(new AssemblyScanner(), () => null);
            var exception = Assert.Throws <InvalidOperationException>(() =>
            {
                // ReSharper disable once UnusedVariable
                var type = endpointTypeDeterminer.GetEndpointConfigurationType().Type;
            });

            Assert.That(exception.Message.StartsWith("Host doesn't support hosting of multiple endpoints"));
        }
            public void when_endpoint_type_is_found_via_assembly_scanning_it_should_have_second_priority()
            {
                AssemblyScannerResults = new AssemblyScannerResults();
                Type     endpointTypeInAssembly;
                Assembly dynamicAssembly = BuildTestEndpointAssembly(out endpointTypeInAssembly);

                AssemblyScannerResults.Assemblies.Add(dynamicAssembly);
                Sut = new EndpointTypeDeterminer(AssemblyScannerResults, () => null);

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;

                Assert.AreEqual(endpointTypeInAssembly, RetrievedEndpointType);
            }
Beispiel #6
0
        public void when_invalid_endpoint_type_is_provided_via_configuration_it_should_blow_up()
        {
            var AssemblyScanner        = new AssemblyScanner();
            var endpointTypeDeterminer = new EndpointTypeDeterminer(AssemblyScanner, () => "I am an invalid type name");

            var exception = Assert.Throws <ConfigurationErrorsException>(() =>
            {
                // ReSharper disable once UnusedVariable
                var type = endpointTypeDeterminer.GetEndpointConfigurationType().Type;
            });

            Assert.That(exception.Message.StartsWith("The 'EndpointConfigurationType' entry in the NServiceBus.Host.exe.config"));
        }
            public void when_no_endpoint_type_found_via_configuration_or_assembly_scanning_it_should_blow_up()
            {
                AssemblyScanner = new AssemblyScanner
                {
                    IncludeExesInScan = false,
                    AssembliesToSkip  = new List <string> {
                        Assembly.GetExecutingAssembly().GetName().Name
                    }
                };

                EndpointTypeDeterminer = new EndpointTypeDeterminer(AssemblyScanner, () => null);

                RetrievedEndpointType = EndpointTypeDeterminer.GetEndpointConfigurationType().Type;
            }
        public void when_no_endpoint_type_found_via_configuration_or_assembly_scanning_it_should_blow_up()
        {
            var AssemblyScanner = new AssemblyScanner
            {
                AssembliesToSkip = new List <string>
                {
                    Assembly.GetExecutingAssembly().GetName().Name
                }
            };

            var endpointTypeDeterminer = new EndpointTypeDeterminer(AssemblyScanner, () => null);

            var exception = Assert.Throws <InvalidOperationException>(() =>
            {
                // ReSharper disable once UnusedVariable
                var type = endpointTypeDeterminer.GetEndpointConfigurationType().Type;
            });

            Assert.That(exception.Message.StartsWith("No endpoint configuration found in scanned assemblies"));
        }
            public void when_endpoint_type_is_found_via_assembly_scanning_it_should_have_second_priority()
            {
                Type endpointTypeInAssembly;

                BuildTestEndpointAssembly(out endpointTypeInAssembly);
                AssemblyScanner = new AssemblyScanner
                {
                    IncludeExesInScan          = false,
                    IncludeAppDomainAssemblies = true,
                    AssembliesToInclude        = new List <string> {
                        endpointTypeInAssembly.Assembly.GetName().Name
                    },
                };

                EndpointTypeDeterminer = new EndpointTypeDeterminer(AssemblyScanner, () => null);

                RetrievedEndpointType = EndpointTypeDeterminer.GetEndpointConfigurationType().Type;

                Assert.AreEqual(endpointTypeInAssembly, RetrievedEndpointType);
            }
            public void when_endpoint_type_is_found_via_assembly_scanning_it_should_have_second_priority()
            {
                Type endpointTypeInAssembly;
                BuildTestEndpointAssembly(out endpointTypeInAssembly);
                AssemblyScanner = new AssemblyScanner
                {
                    IncludeExesInScan = false,
                    IncludeAppDomainAssemblies = true,
                    AssembliesToInclude = new List<string> { endpointTypeInAssembly.Assembly.GetName().Name },
                };

                EndpointTypeDeterminer = new EndpointTypeDeterminer(AssemblyScanner, () => null);

                RetrievedEndpointType = EndpointTypeDeterminer.GetEndpointConfigurationType().Type;

                Assert.AreEqual(endpointTypeInAssembly, RetrievedEndpointType);
            }
            public void when_endpoint_type_is_found_via_assembly_scanning_it_should_have_second_priority()
            {
                AssemblyScannerResults = new AssemblyScannerResults();
                Type endpointTypeInAssembly;
                Assembly dynamicAssembly = BuildTestEndpointAssembly(out endpointTypeInAssembly);
                AssemblyScannerResults.Assemblies.Add(dynamicAssembly);
                Sut = new EndpointTypeDeterminer(AssemblyScannerResults, () => null);

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;

                Assert.AreEqual(endpointTypeInAssembly, RetrievedEndpointType);
            }
            public void when_endpoint_type_is_provided_via_configuration_it_should_have_first_priority()
            {
                Sut = new EndpointTypeDeterminer(AssemblyScanner.GetScannableAssemblies(),
                                                 () => ConfigurationManager.AppSettings["EndpointConfigurationType"]);

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;

                Assert.AreEqual(EndpointTypeDefinedInConfigurationFile, RetrievedEndpointType);
            }
            public void when_no_endpoint_type_found_via_configuration_or_assembly_scanning_it_should_blow_up()
            {
                AssemblyScanner = new AssemblyScanner
                {
                    IncludeExesInScan = false,
                    AssembliesToSkip = new List<string> { Assembly.GetExecutingAssembly().GetName().Name }
                };

                EndpointTypeDeterminer = new EndpointTypeDeterminer(AssemblyScanner, () => null);

                RetrievedEndpointType = EndpointTypeDeterminer.GetEndpointConfigurationType().Type;
            }
            public void when_no_endpoint_type_found_via_configuration_or_assembly_scanning_it_should_blow_up()
            {
                Sut = new EndpointTypeDeterminer(new AssemblyScannerResults(), () => null);

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;
            }
            public void when_multiple_endpoint_types_found_via_assembly_scanning_it_should_blow_up()
            {
                Sut = new EndpointTypeDeterminer(AssemblyScanner.GetScannableAssemblies(), () => null);

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;
            }
            public void when_invalid_endpoint_type_is_provided_via_configuration_it_should_blow_up()
            {
                Sut = new EndpointTypeDeterminer(AssemblyScanner.GetScannableAssemblies(),
                                                 () => "I am an invalid type name");

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;
            }
            public void when_multiple_endpoint_types_found_via_assembly_scanning_it_should_blow_up()
            {
                Sut = new EndpointTypeDeterminer(AssemblyScanner.GetScannableAssemblies(), () => null);

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;
            }
            public void when_no_endpoint_type_found_via_configuration_or_assembly_scanning_it_should_blow_up()
            {
                Sut = new EndpointTypeDeterminer(new AssemblyScannerResults(), () => null);

                RetrievedEndpointType = Sut.GetEndpointConfigurationType().Type;
            }