EndPointFactory

Namespace: JustEat.StatsD
We found 10 examples in language CSharp for this search. You will see 17 fragments of code.

Other methods

Other methods

        [Fact]
        public void GetPathByAddress_WithoutHttpContext_NoMatches_ReturnsNull()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint("{controller}/{action}/{id?}", metadata: new object[] { new IntMetadata(1), });

            var linkGenerator = CreateLinkGenerator(endpoint);

            // Act
            var path = linkGenerator.GetPathByAddress(0, values: null);

            // Assert
            Assert.Null(path);
        }


        [Fact]
        public void AddressScheme_IgnoresEndpointsWithSuppressLinkGeneration()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint(
                "/a",
                metadata: new object[] { new EndpointNameMetadata("name1"), new SuppressLinkGenerationMetadata(), });

            // Act
            var addressScheme = CreateAddressScheme(endpoint);

            // Assert
            Assert.Empty(addressScheme.Entries);
        }

        [Fact]
        public void AddressScheme_IgnoresEndpointsWithoutEndpointName()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint(
                "/a",
                metadata: new object[] { });

            // Act
            var addressScheme = CreateAddressScheme(endpoint);

            // Assert
            Assert.Empty(addressScheme.Entries);
        }


        public static IHttpClientBuilder AddApiClient<TService>(
            this IServiceCollection services,
            Func<IServiceProvider, Uri> endpointFactory)
            where TService : class
            => AddApiClient<TService>(services, endpointFactory.Invoke(services.BuildServiceProvider()), false);

        public static IHttpClientBuilder AddApiClient<TService>(
            this IServiceCollection services,
            Func<IServiceProvider, string> endpointFactory)
            where TService : class
            => AddApiClient<TService>(services, endpointFactory.Invoke(services.BuildServiceProvider()), false);


            public override void ExitSystemEndpoint(RouteParser.SystemEndpointContext context)
            {
                string systemEndpoint = context.GetText();
                Endpoint endpoint = this.endpointFactory.CreateSystemEndpoint(systemEndpoint);
                this.Endpoint = endpoint;
            }

            public override void ExitFuncEndpoint(RouteParser.FuncEndpointContext context)
            {
                string funcName = context.func.Text;
                string address = context.endpoint.Text.Substring(1, context.endpoint.Text.Length - 2);
                Endpoint endpoint = this.endpointFactory.CreateFunctionEndpoint(funcName, address);
                this.Endpoint = endpoint;
            }


        [Fact]
        public void TestCreateSystemEndpoint()
        {
            Endpoint endpoint = this.endpointFactory.CreateSystemEndpoint("$upstream");
            Assert.NotNull(endpoint);
            Assert.IsType<CloudEndpoint>(endpoint);

            Endpoint endpoint2 = this.endpointFactory.CreateSystemEndpoint("$upstream");
            Assert.NotNull(endpoint2);
            Assert.IsType<CloudEndpoint>(endpoint2);
            Assert.Equal(endpoint, endpoint2);
        }

        [Fact]
        public void TestCreateFunctionEndpoint()
        {
            Endpoint endpoint = this.endpointFactory.CreateFunctionEndpoint("BrokeredEndpoint", "/modules/alertLogic/inputs/in1");
            Assert.NotNull(endpoint);

            var moduleEndpoint = endpoint as ModuleEndpoint;
            Assert.NotNull(moduleEndpoint);
            Assert.Equal("Device1/alertLogic/in1", moduleEndpoint.Id);
            Assert.Equal("in1", moduleEndpoint.Input);
        }

        [Theory]
        [InlineData("upstream")]
        [InlineData("PascalCase")]
        [InlineData("")]
        [InlineData(null)]
        public void TestCreateSystemEndpointInvalidCases(string systemEndpoint)
        {
            Assert.Throws<InvalidOperationException>(() => this.endpointFactory.CreateSystemEndpoint(systemEndpoint));
        }

        [Fact]
        public void GetPathByAddress_WithoutHttpContext_NoMatches_ReturnsNull()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint("{controller}/{action}/{id?}", metadata: new object[] { new IntMetadata(1), });

            var linkGenerator = CreateLinkGenerator(endpoint);

            // Act
            var path = linkGenerator.GetPathByAddress(0, values: null);

            // Assert
            Assert.Null(path);
        }

        [Fact]
        public void GetPathByAddress_WithoutHttpContext_NoMatches_ReturnsNull()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint("{controller}/{action}/{id?}", metadata: new object[] { new IntMetadata(1), });

            var linkGenerator = CreateLinkGenerator(endpoint);

            // Act
            var path = linkGenerator.GetPathByAddress(0, values: null);

            // Assert
            Assert.Null(path);
        }


        [Fact]
        public void AddressScheme_IgnoresEndpointsWithSuppressLinkGeneration()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint(
                "/a",
                metadata: new object[] { new EndpointNameMetadata("name1"), new SuppressLinkGenerationMetadata(), });

            // Act
            var addressScheme = CreateAddressScheme(endpoint);

            // Assert
            Assert.Empty(addressScheme.Entries);
        }

        [Fact]
        public void AddressScheme_IgnoresEndpointsWithoutEndpointName()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint(
                "/a",
                metadata: new object[] { });

            // Act
            var addressScheme = CreateAddressScheme(endpoint);

            // Assert
            Assert.Empty(addressScheme.Entries);
        }


        [Fact]
        public void AddressScheme_IgnoresEndpointsWithSuppressLinkGeneration()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint(
                "/a",
                metadata: new object[] { new EndpointNameMetadata("name1"), new SuppressLinkGenerationMetadata(), });

            // Act
            var addressScheme = CreateAddressScheme(endpoint);

            // Assert
            Assert.Empty(addressScheme.Entries);
        }

        [Fact]
        public void AddressScheme_IgnoresEndpointsWithoutEndpointName()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint(
                "/a",
                metadata: new object[] { });

            // Act
            var addressScheme = CreateAddressScheme(endpoint);

            // Assert
            Assert.Empty(addressScheme.Entries);
        }

        [Fact]
        public void GetPathByAddress_WithoutHttpContext_NoMatches_ReturnsNull()
        {
            // Arrange
            var endpoint = EndpointFactory.CreateRouteEndpoint("{controller}/{action}/{id?}", metadata: new object[] { new IntMetadata(1), });

            var linkGenerator = CreateLinkGenerator(endpoint);

            // Act
            var path = linkGenerator.GetPathByAddress(0, values: null);

            // Assert
            Assert.Null(path);
        }

JustEat.StatsD.EndpointLookups.EndPointFactory : Object

Methods :

public static IEndPointSource MakeEndPointSource(EndPoint endpoint = , Nullable<TimeSpan> endpointCacheDuration = )
public static IEndPointSource MakeEndPointSource(String host = , Int32 port = , Nullable<TimeSpan> endpointCacheDuration = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()