public void SendLogMessageToLoggly___Should_throw_InvalidOperationException___When_Initialize_has_not_been_called() { // Arrange, Act var ex = Record.Exception(() => LogglySender.SendLogMessageToLoggly(A.Dummy <string>(), A.Dummy <string>(), A.Dummy <string>(), A.Dummy <Severity>(), DateTime.UtcNow, A.Dummy <string>(), A.Dummy <string>())); // Assert ex.Should().BeOfType <InvalidOperationException>(); ex.Message.Should().Be("Initialize has not yet been called."); }
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); }