public void Initialize___Should_throw_ArgumentNullException___When_parameter_logglySettings_is_null() { // Arrange, Act var ex = Record.Exception(() => LogglySender.Initialize(null)); // Assert ex.Should().BeOfType <ArgumentNullException>(); ex.Message.Should().Contain("logglySettings"); }
public void Initialize___Should_throw_ArgumentException___When_parameter_logglySettings_LogglyPrivateEnterpriseNumber_is_null() { // Arrange var settings = BuildLogglySettings(); settings.LogglyPrivateEnterpriseNumber = null; // Act var ex = Record.Exception(() => LogglySender.Initialize(settings)); // Assert ex.Should().BeOfType <ArgumentException>(); ex.Message.Should().Contain("'logglySettings.LogglyPrivateEnterpriseNumber' is null or white space"); }
public void Initialize___Should_throw_ArgumentException___When_parameter_logglySettings_LogglyServerCertificatePemEncoded_is_null() { // Arrange var settings = BuildLogglySettings(); settings.LogglyServerCertificatePemEncoded = null; // Act var ex = Record.Exception(() => LogglySender.Initialize(settings)); // Assert ex.Should().BeOfType <ArgumentException>(); ex.Message.Should().Contain("LogglyServerCertificatePemEncoded"); }
public void Initialize___Should_throw_ArgumentException___When_parameter_logglySettings_SecurePort_is_default_value() { // Arrange var settings = BuildLogglySettings(); settings.SecurePort = default(int); // Act var ex = Record.Exception(() => LogglySender.Initialize(settings)); // Assert ex.Should().BeOfType <ArgumentException>(); ex.Message.Should().Be("'SecurePort' has not be set"); }
public void Initialize___Should_throw_ArgumentException___When_parameter_logglySettings_CustomerToken_is_white_space() { // Arrange var settings = BuildLogglySettings(); settings.CustomerToken = " \r\n "; // Act var ex = Record.Exception(() => LogglySender.Initialize(settings)); // Assert ex.Should().BeOfType <ArgumentException>(); ex.Message.Should().Contain("CustomerToken"); ex.Message.Should().Contain("white space"); }
public void SendLogMessageToLoggly() { // Arrange var settings = BuildLogglySettings(); LogglySender.Initialize(settings); var machineName = "MachineName"; var applicationName = "ApplicationName"; var processId = "ProcessId"; var severity = Severity.Notice; var timestamp = DateTime.UtcNow; var messagePayload = "{ \"property1\": true, \"property2\": \"some text\" }"; var messageType = "MessageType"; var tags = new[] { new LogglyTag("tag1"), new LogglyTag("tag2") }; // Act, Assert LogglySender.SendLogMessageToLoggly(machineName, applicationName, processId, severity, timestamp, messagePayload, messageType, tags); }