示例#1
0
        public void RegisterMessage_EmptyMessage_TrowsException()
        {
            var messageRegister = new MessageRegister();

            var ex = Assert.Catch <Exception>(() =>
                                              messageRegister.RegisterMessage(null));

            StringAssert.Contains("Value cannot be null", ex.Message);
        }
示例#2
0
        public void RegisterMessage_EmptyUser_TrowsException()
        {
            var messageRegister = new MessageRegister();
            var user            = new User {
                ChatId = "null", MessengerClass = null
            };
            var message = new Message(user)
            {
                BasicText = "Test"
            };

            var ex = Assert.Catch <Exception>(() => messageRegister.RegisterMessage(message));

            StringAssert.Contains("Value cannot be null", ex.Message);
        }
示例#3
0
        public void RegisterMessage_UnknownMessage_ReturnsFirstLevelState()
        {
            var messageRegister = new MessageRegister();
            var user            = new User {
                ChatId = "123456", MessengerClass = nameof(FakeMessengerApi)
            };
            var message = new Message(user)
            {
                BasicText = "Test"
            };

            var states = messageRegister.RegisterMessage(message);

            Assert.AreEqual(UserStates.FirstLevel, states);
        }
示例#4
0
        public void SetState_UnknownUser_SetStateToUser()
        {
            var messageRegister = new MessageRegister();
            var user            = new User {
                ChatId = "123456", MessengerClass = nameof(FakeMessengerApi)
            };
            var message = new Message(user)
            {
                BasicText = "Test"
            };

            messageRegister.SetState(message, UserStates.SecondLevel);
            var states = messageRegister.RegisterMessage(message);

            Assert.AreEqual(UserStates.SecondLevel, states);
        }