Exemplo n.º 1
0
        public void AddMessage_EmptyMessage_TrowsException()
        {
            var messageHistory = new MessageHistory();

            var ex = Assert.Catch <Exception>(() => messageHistory.AddMessage(null));


            StringAssert.Contains("Value cannot be null", ex.Message);
        }
Exemplo n.º 2
0
        public void AddMessage_EmptyUser_TrowsException()
        {
            var messageHistory = new MessageHistory();
            var user           = new User {
                ChatId = null, MessengerClass = null
            };
            var message = new Message(user)
            {
                BasicText = "Test"
            };

            var ex = Assert.Catch <Exception>(() => messageHistory.AddMessage(message));


            StringAssert.Contains("Value cannot be null", ex.Message);
        }
Exemplo n.º 3
0
        public void AddMessage_WhenCall_AddsMessageToDictionary()
        {
            var messageHistory = new MessageHistory();
            var user           = new User {
                ChatId = "123456", MessengerClass = nameof(FakeMessengerApi)
            };
            var message = new Message(user)
            {
                BasicText = "Test"
            };

            messageHistory.AddMessage(message);
            var gettingMessage = messageHistory.GetMessage(user);

            Assert.AreSame(gettingMessage, message);
        }