Beispiel #1
0
        public void NullQuestTest()
        {
            //Arrange
            IdleQuestValidator validator = new IdleQuestValidator();

            //Act
            ArgumentNullException ex = Assert.Throws <ArgumentNullException>(() => validator.Validate(null));

            //Assert
            Assert.IsNotNull(ex);
            Assert.AreEqual("quest", ex.ParamName);
        }
Beispiel #2
0
        public void ValidateQuestSuccessfulTest(State state)
        {
            //Arrange
            IdleQuestValidator validator = new IdleQuestValidator();
            Quest quest = QuestHelper.CreateQuest(state);

            //Act
            StringResponse result = validator.Validate(quest);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.IsSuccessful);
        }
Beispiel #3
0
        public void ValidateQuestWithWrongStateTest(State state)
        {
            //Arrange
            IdleQuestValidator validator = new IdleQuestValidator();
            Quest quest = QuestHelper.CreateQuest(state);

            //Act
            StringResponse result = validator.Validate(quest);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsSuccessful);
            Assert.AreEqual(1, result.Errors.Count);
            Assert.AreEqual("ERR_QUEST_ACT_WRONG_STATE", result.Errors[0]);
        }