Example #1
0
 public static void EnsurePort([NotNull] Type applicationType, [NotNull] IVostokHostingEnvironmentBuilder builder)
 {
     if (RequirementDetector.RequiresPort(applicationType))
     {
         builder.SetPort(FreeTcpPortFinder.GetFreePort());
     }
 }
Example #2
0
        private async Task <bool> WaitForServiceBeaconRegistrationIfNeededAsync(IServiceBeacon beacon)
        {
            if (!RequirementDetector.RequiresPort(settings.Application) || !settings.BeaconRegistrationWaitEnabled || !(beacon is ServiceBeacon convertedBeacon))
            {
                return(true);
            }

            return(await convertedBeacon.WaitForInitialRegistrationAsync()
                   .TryWaitAsync(settings.BeaconRegistrationTimeout)
                   .ConfigureAwait(false));
        }
        public void Should_detect_attributes_from_static_property_of_base_class()
        {
            var application = new DerivedGenericApplication <string>();

            var extensions = RequirementDetector.GetRequiredHostExtensions(application).ToArray();

            extensions.Should().HaveCount(2);

            extensions[0].Type.Should().Be(typeof(Guid));
            extensions[1].Type.Should().Be(typeof(string));

            RequirementDetector.RequiresPort(application).Should().BeTrue();
        }
        public void Should_support_composite_applications()
        {
            var application = new MultiApplication();

            RequirementDetector.RequiresPort(application).Should().BeTrue();

            RequirementDetector.GetRequiredConfigurations(application)
            .Should()
            .ContainSingle()
            .Which.Type.Should()
            .Be(typeof(string));

            var extensions = RequirementDetector.GetRequiredHostExtensions(application).ToArray();

            extensions.Should().HaveCount(4);

            extensions[0].Type.Should().Be(typeof(IGenericInterface <string>));
            extensions[1].Type.Should().Be(typeof(IGenericInterface <string>));
            extensions[2].Type.Should().Be(typeof(Guid));
            extensions[3].Type.Should().Be(typeof(int));
        }
 public void Should_detect_attributes_from_base_classes()
 {
     RequirementDetector.RequiresPort(new Application()).Should().BeTrue();
 }