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); }
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); }
public void when_invalid_endpoint_type_is_provided_via_hostargs_it_should_blow_up() { Sut = new EndpointTypeDeterminer(AssemblyScannerResults, () => ConfigurationManager.AppSettings["EndpointConfigurationType"]); hostArguments = new HostArguments(new string[0]) { EndpointConfigurationType = "I am an invalid type name" }; RetrievedEndpointType = Sut.GetEndpointConfigurationTypeForHostedEndpoint(hostArguments).Type; }
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_not_provided_via_hostargs_it_should_fall_through_to_other_modes_of_determining_endpoint_type() { Sut = new EndpointTypeDeterminer(AssemblyScannerResults, () => ConfigurationManager.AppSettings["EndpointConfigurationType"]); hostArguments = new HostArguments(new string[0]); // will match with config-based type RetrievedEndpointType = Sut.GetEndpointConfigurationTypeForHostedEndpoint(hostArguments).Type; Assert.AreEqual(EndpointTypeDefinedInConfigurationFile, RetrievedEndpointType); }
when_endpoint_type_is_not_provided_via_hostargs_it_should_fall_through_to_other_modes_of_determining_endpoint_type () { Sut = new EndpointTypeDeterminer(AssemblyScannerResults, () => ConfigurationManager.AppSettings["EndpointConfigurationType"]); hostArguments = new HostArguments(new string[0]); // will match with config-based type RetrievedEndpointType = Sut.GetEndpointConfigurationTypeForHostedEndpoint(hostArguments).Type; Assert.AreEqual(EndpointTypeDefinedInConfigurationFile, RetrievedEndpointType); }
public void when_endpoint_type_is_not_provided_via_hostArgs_it_should_fall_through_to_other_modes_of_determining_endpoint_type() { var endpointTypeDefinedInConfigurationFile = typeof(MyEndpointConfig); var endpointTypeDeterminer = new EndpointTypeDeterminer(new AssemblyScanner(), () => ConfigurationManager.AppSettings["EndpointConfigurationType"]); var hostArguments = new HostArguments(new string[0]); // will match with config-based type var RetrievedEndpointType = endpointTypeDeterminer.GetEndpointConfigurationTypeForHostedEndpoint(hostArguments).Type; Assert.AreEqual(endpointTypeDefinedInConfigurationFile, RetrievedEndpointType); }
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_endpoint_type_is_provided_via_hostargs_it_should_have_first_priority() { Sut = new EndpointTypeDeterminer(AssemblyScannerResults, () => ConfigurationManager.AppSettings["EndpointConfigurationType"]); hostArguments = new HostArguments(new string[0]) { EndpointConfigurationType = typeof (TestEndpointType).AssemblyQualifiedName }; RetrievedEndpointType = Sut.GetEndpointConfigurationTypeForHostedEndpoint(hostArguments).Type; Assert.AreEqual(typeof (TestEndpointType), 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_hostargs_it_should_have_first_priority() { Sut = new EndpointTypeDeterminer(AssemblyScannerResults, () => ConfigurationManager.AppSettings["EndpointConfigurationType"]); hostArguments = new HostArguments(new string[0]) { EndpointConfigurationType = typeof(TestEndpointType).AssemblyQualifiedName }; RetrievedEndpointType = Sut.GetEndpointConfigurationTypeForHostedEndpoint(hostArguments).Type; Assert.AreEqual(typeof(TestEndpointType), 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_invalid_endpoint_type_is_provided_via_hostArgs_it_should_blow_up() { var endpointTypeDeterminer = new EndpointTypeDeterminer(new AssemblyScanner(), () => ConfigurationManager.AppSettings["EndpointConfigurationType"]); var hostArguments = new HostArguments(new string[0]) { EndpointConfigurationType = "I am an invalid type name" }; Assert.Throws <ConfigurationErrorsException>(() => { // ReSharper disable once UnusedVariable var type = endpointTypeDeterminer.GetEndpointConfigurationTypeForHostedEndpoint(hostArguments).Type; }); }
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_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_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; }