public void UseProxy_Action_ProxySet() { var builder = new MqttClientConfigBuilder(); builder .ConnectViaWebSocket("uri") .UseProxy( options => { options.Address = "address"; options.Username = "******"; options.Password = "******"; options.Domain = "domain"; options.BypassOnLocal = true; options.BypassList = new[] { "local1", "local2" }; }); var config = builder.Build(); config.ChannelOptions.As <MqttClientWebSocketOptions>().ProxyOptions.Should().NotBeNull(); config.ChannelOptions.As <MqttClientWebSocketOptions>().ProxyOptions.Address.Should() .Be("address"); config.ChannelOptions.As <MqttClientWebSocketOptions>().ProxyOptions.Username.Should().Be("user"); config.ChannelOptions.As <MqttClientWebSocketOptions>().ProxyOptions.Password.Should().Be("pass"); config.ChannelOptions.As <MqttClientWebSocketOptions>().ProxyOptions.Domain.Should().Be("domain"); config.ChannelOptions.As <MqttClientWebSocketOptions>().ProxyOptions.BypassOnLocal.Should() .BeTrue(); config.ChannelOptions.As <MqttClientWebSocketOptions>().ProxyOptions.BypassList.Should() .BeEquivalentTo("local1", "local2"); }
public void ConnectViaWebSocket_Uri_ChannelOptionsSet() { var builder = new MqttClientConfigBuilder(); builder.ConnectViaWebSocket("uri"); var config = builder.Build(); config.ChannelOptions.Should().BeOfType <MqttClientWebSocketOptions>(); config.ChannelOptions.As <MqttClientWebSocketOptions>().Uri.Should().Be("uri"); }
public void ConnectViaWebSocket_Action_ChannelOptionsSet() { var builder = new MqttClientConfigBuilder(); builder.ConnectViaWebSocket( options => { options.Uri = "uri"; options.RequestHeaders = new Dictionary <string, string> { { "header", "value" } }; }); var config = builder.Build(); config.ChannelOptions.Should().BeOfType <MqttClientWebSocketOptions>(); config.ChannelOptions.As <MqttClientWebSocketOptions>().Uri.Should().Be("uri"); config.ChannelOptions.As <MqttClientWebSocketOptions>().RequestHeaders.Should().BeEquivalentTo( new Dictionary <string, string> { { "header", "value" } }); }