You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 line
674 B

  1. using System.Linq;
  2. using System.Text;
  3. using Microsoft.VisualStudio.TestTools.UnitTesting;
  4. using MQTTnet.Client.Options;
  5. using MQTTnet.Extensions;
  6. namespace MQTTnet.Tests
  7. {
  8. [TestClass]
  9. public class MqttClientOptionsBuilder_Tests
  10. {
  11. [TestMethod]
  12. public void WithConnectionUri_Credential_Test()
  13. {
  14. var options = new MqttClientOptionsBuilder()
  15. .WithConnectionUri("mqtt://user:password@127.0.0.1")
  16. .Build();
  17. Assert.AreEqual("user", options.Credentials.Username);
  18. Assert.IsTrue(Encoding.UTF8.GetBytes("password").SequenceEqual(options.Credentials.Password));
  19. }
  20. }
  21. }