public void Constructor_WithWebSocketBaseConfig_InitializedFromBaseConfig() { var builder = new MqttClientConfigBuilder(); builder .UseProtocolVersion(MqttProtocolVersion.V311) .ConnectViaWebSocket("uri") .UseProxy( options => { options.Address = "address"; options.Username = "******"; options.Password = "******"; options.Domain = "domain"; options.BypassOnLocal = true; options.BypassList = new[] { "local1", "local2" }; }) .EnableTls( parameters => { parameters.SslProtocol = SslProtocols.Tls12; parameters.AllowUntrustedCertificates = true; }) .UseExtendedAuthenticationExchangeHandler(new TestExtendedAuthenticationExchangeHandler()); var baseConfig = builder.Build(); var config = new MqttClientConfigBuilder(baseConfig).Build(); config.Should().BeEquivalentTo(baseConfig); config.Should().NotBeSameAs(baseConfig); }
public void Constructor_WithTcpBaseConfig_InitializedFromBaseConfig() { var builder = new MqttClientConfigBuilder(); builder .UseProtocolVersion(MqttProtocolVersion.V311) .ConnectViaTcp("tests-server", 1234) .EnableTls( parameters => { parameters.SslProtocol = SslProtocols.Tls12; parameters.AllowUntrustedCertificates = true; }) .UseExtendedAuthenticationExchangeHandler(new TestExtendedAuthenticationExchangeHandler()); var baseConfig = builder.Build(); var config = new MqttClientConfigBuilder(baseConfig).Build(); config.Should().BeEquivalentTo(baseConfig); config.Should().NotBeSameAs(baseConfig); }