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

            ex.AddMessages(null);
            Assert.Equal(0, ex.Messages.Count);
        }
Beispiel #2
0
        private void NullMessagesCollectionIsNotAddedToMessagesCollection()
        {
            var ex = new BadGatewayException();

            ex.AddMessages(null);
            Assert.Empty(ex.Messages);
        }
        private void EmptyMessagesCollectionWithKeyIsNotAddedToMessagesCollection()
        {
            var ex = new BadGatewayException();

            ex.AddMessages("Key1", new string[0]);
            Assert.Equal(0, ex.Messages.Count);
        }
Beispiel #4
0
        private void EmptyMessagesCollectionIsNotAddedToMessagesCollection()
        {
            var ex = new BadGatewayException();

            ex.AddMessages(new string[0]);
            Assert.Empty(ex.Messages);
        }
        private void MessagesAreAddedToMessagesCollectionUnderDifferentKey()
        {
            var message1  = "message1";
            var message2  = "messages2";
            var messages1 = new string[] { message1 };
            var messages2 = new string[] { message2 };

            var ex = new BadGatewayException();

            ex.AddMessages("key1", messages1);
            ex.AddMessages("key2", messages2);

            Assert.Equal(2, ex.Messages.Count);

            Assert.True(ex.Messages.ContainsKey("key1"));
            Assert.True(ex.Messages.ContainsKey("key2"));
            Assert.Contains(message1, ex.Messages["key1"]);
            Assert.Contains(message2, ex.Messages["key2"]);
        }
        private void NonDefaultEmptyKeyMessagesCollectionThrowsException()
        {
            var message1 = "message1";
            var message2 = "messages2";
            var messages = new string[] { message1, message2 };

            var ex     = new BadGatewayException();
            var result = Assert.Throws <ArgumentNullException>(() => ex.AddMessages(" ", messages));

            Assert.Equal("key", result.ParamName);
        }
        private void MessagesAreAddedToMessagesCollectionUnderSameKey()
        {
            var message1  = "message1";
            var message2  = "messages2";
            var messages1 = new string[] { message1 };
            var messages2 = new string[] { message2 };

            var ex = new BadGatewayException();

            ex.AddMessages(messages1);
            ex.AddMessages(messages2);

            Assert.Equal(1, ex.Messages.Count);

            var values = ex.Messages.SelectMany(m => m.Value);
            var keys   = ex.Messages.Select(m => m.Key);

            Assert.Contains(message1, values);
            Assert.Contains(message2, values);
            Assert.All(keys, k => Assert.Equal(Defaults.ErrorMessage.Key, k));
        }
        private void MessagesAreAddedToMessagesCollection()
        {
            var message1 = "message1";
            var message2 = "messages2";
            var messages = new string[] { message1, message2 };

            var error = new BadGatewayException();

            error.AddMessages(messages);

            var message = error.Messages.First();

            Assert.Equal(1, error.Messages.Count);

            Assert.Contains(message1, message.Value);
            Assert.Contains(message2, message.Value);
            Assert.Equal(message.Key, Defaults.ErrorMessage.Key);
        }