private void NullMessagesOnlyIsNotAddedToMessagesCollection()
        {
            var ex = new BadGatewayException();

            ex.AddMessage(null);
            ex.AddMessage(string.Empty);
            Assert.Equal(0, ex.Messages.Count);
        }
        private void NullMessageWithValidKeyIsNotAddedToMessagesCollection()
        {
            var ex = new BadGatewayException();

            ex.AddMessage("aKey", null);
            Assert.Equal(0, ex.Messages.Count);
        }
        private void NullKeyThrowsArgumentNullException()
        {
            var ex     = new BadGatewayException();
            var result = Assert.Throws <ArgumentNullException>(() => ex.AddMessage(null, "aMessage"));

            Assert.Equal("key", result.ParamName);
        }
        private void DefaultEmptyKeyAddsToCollection()
        {
            var ex = new BadGatewayException();

            ex.AddMessage(Defaults.ErrorMessage.Key, "aMessage");

            Assert.Equal(1, ex.Messages.Count);
            Assert.Contains("aMessage", ex.Messages.First().Value);
        }
        private void KeyAndMessageAreAddedToMessagesCollection()
        {
            var ex = new BadGatewayException();

            ex.AddMessage("aKey", "aMessage");

            Assert.Equal(1, ex.Messages.Count);
            Assert.Equal("aKey", ex.Messages.First().Key);
            Assert.Contains("aMessage", ex.Messages.First().Value);
        }
        private void MessageIsAddedToMessagesCollectionWithDefaultKey()
        {
            var ex = new BadGatewayException();

            ex.AddMessage("aMessage");

            Assert.Equal(1, ex.Messages.Count);
            Assert.Contains("aMessage", ex.Messages.First().Value);
            Assert.Equal(Defaults.ErrorMessage.Key, ex.Messages.First().Key);
        }