public void ToString_IgnoresNullParameters()
        {
            // Arrange
            var sut = ServiceMessage.Create("my-message-name", ("foo", "1"), ("bar", null));

            // Act
            var text = sut.ToString();

            // Assert
            // Base64 encoding "1" gives "MQ=="
            text.Should().Be("##octopus[my-message-name foo=\"MQ==\"]");
        }
        public void ToString_FormatsMessageCorrectly()
        {
            // Arrange
            var sut = ServiceMessage.Create("my-message-name", ("foo", "my-parameter-value"));

            // Act
            var text = sut.ToString();

            // Assert
            // Base65 encoding "my-parameter-value" gives "bXktcGFyYW1ldGVyLXZhbHVl"
            text.Should().Be("##octopus[my-message-name foo=\"bXktcGFyYW1ldGVyLXZhbHVl\"]");
        }
Ejemplo n.º 3
0
        public void WriteServiceMessage_CorrectlyFormatsMessages()
        {
            // Arrange
            var serviceMessage = ServiceMessage.Create("do-it", ("foo", "1"), ("bar", null));

            // Testing functionality from abstract base class, so it doesn't matter that this is a test class.
            var sut = new InMemoryLog();

            // Act
            sut.WriteServiceMessage(serviceMessage);

            // Assert
            sut.Messages.Should().ContainSingle().Which.FormattedMessage.Should().Be("##octopus[do-it foo=\"MQ==\"]");
        }