NucuCar/NucuCar.UnitTests/NucuCar.Telemetry/TelemetryPublisherFactoryTest.cs

39 lines
1.2 KiB
C#
Raw Permalink Normal View History

2019-12-28 15:09:17 +00:00
using System;
using NucuCar.Telemetry;
2020-08-01 15:07:13 +00:00
using NucuCar.Telemetry.Publishers;
2019-12-28 15:09:17 +00:00
using Xunit;
namespace NucuCar.UnitTests.NucuCar.Telemetry
2019-12-28 15:09:17 +00:00
{
public class TelemetryPublisherFactoryTest
{
[Fact]
private void Test_Build_TelemetryPublisherAzure()
{
const string connectionString =
"HostName=something.azure-devices.net;DeviceId=something;SharedAccessKey=test";
var telemetryPublisher =
PublisherFactory.CreateFromConnectionString(PublisherType.Azure, connectionString);
Assert.IsType<Azure>(telemetryPublisher);
2019-12-28 15:09:17 +00:00
}
[Fact]
private void Test_Build_TelemetryPublisherDisk()
{
const string connectionString =
"Filename=test;BufferSize=4096";
var telemetryPublisher =
PublisherFactory.CreateFromConnectionString(PublisherType.Disk, connectionString);
Assert.IsType<Disk>(telemetryPublisher);
2019-12-28 15:09:17 +00:00
}
2019-12-28 15:09:17 +00:00
[Fact]
private void Test_Build_ThrowsOnInvalidType()
{
Assert.Throws<ArgumentException>(() =>
{
PublisherFactory.CreateFromConnectionString("_1", "a=b");
2019-12-28 15:09:17 +00:00
});
}
}
}