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.
 
 
 
 

31 rivejä
797 B

  1. using Microsoft.Extensions.DependencyInjection;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. namespace MQTTnet.Core.Tests
  4. {
  5. [TestClass]
  6. public class ServiceCollectionTest
  7. {
  8. [TestMethod]
  9. public void TestCanConstructAllServices()
  10. {
  11. var services = new ServiceCollection()
  12. .AddLogging()
  13. .AddMqttServer()
  14. .AddMqttClient();
  15. var serviceProvider = services
  16. .BuildServiceProvider();
  17. foreach (var service in services)
  18. {
  19. if (service.ServiceType.IsGenericType)
  20. {
  21. continue;
  22. }
  23. serviceProvider.GetRequiredService(service.ServiceType);
  24. }
  25. }
  26. }
  27. }