示例#1
0
        public void CreateInvokeHttpClient_InvalidDaprEndpoint_InvalidScheme()
        {
            var ex = Assert.Throws <ArgumentException>(() =>
            {
                _ = DaprClient.CreateInvokeHttpClient(daprEndpoint: "ftp://localhost:3500");
            });

            Assert.Contains("The URI scheme of the Dapr endpoint must be http or https.", ex.Message);
        }
示例#2
0
        public void CreateInvokeHttpClient_InvalidDaprEndpoint_InvalidFormat()
        {
            Assert.Throws <UriFormatException>(() =>
            {
                _ = DaprClient.CreateInvokeHttpClient(daprEndpoint: "");
            });

            // Exception message comes from the runtime, not validating it here.
        }
示例#3
0
        public void CreateInvokeHttpClient_InvalidAppId()
        {
            var ex = Assert.Throws <ArgumentException>(() =>
            {
                // The appId needs to be something that can be used as hostname in a URI.
                _ = DaprClient.CreateInvokeHttpClient(appId: "");
            });

            Assert.Contains("The appId must be a valid hostname.", ex.Message);
            Assert.IsType <UriFormatException>(ex.InnerException);
        }
示例#4
0
        public void CreateInvokeHttpClient_WithoutAppId()
        {
            var client = DaprClient.CreateInvokeHttpClient(daprEndpoint: "http://localhost:3500");

            Assert.Null(client.BaseAddress);
        }
示例#5
0
        public void CreateInvokeHttpClient_WithAppId()
        {
            var client = DaprClient.CreateInvokeHttpClient(appId: "bank", daprEndpoint: "http://localhost:3500");

            Assert.Equal("http://bank/", client.BaseAddress.AbsoluteUri);
        }