Пример #1
0
        public void Apply_NotACharacter_Test()
        {
            var entity   = Mock.Of <IEntity>();
            var confused = new Confused();

            confused.Apply(entity);
            Assert.IsTrue(true); // If we made it here without exception then the test passed
        }
Пример #2
0
        public void Remove_Character_RemovesConfusedAndFlatFooted_NotAlreadyPresent_Test()
        {
            var character = CreateMockCharacter();
            var confused  = new Confused();

            confused.Apply(character);
            confused.Remove(character);
            Assert.AreEqual(0, character.Conditions.Count);
        }
Пример #3
0
        public void Apply_Character_WithExistingConfusedCondition_Test()
        {
            var character = CreateMockCharacter();

            character.Conditions.Add(new Confused());
            var confused = new Confused();

            confused.Apply(character);
        }
Пример #4
0
        public void Apply_Character_NoConditions_Test()
        {
            var character = CreateMockCharacter();
            var confused  = new Confused();

            confused.Apply(character);
            Assert.AreEqual(EntityIds.CONFUSED_CONDITION_ID, character.Conditions[0].Id);
            Assert.AreSame(confused, character.Conditions[0]);
        }
Пример #5
0
        public void Apply_Character_AddsFlatFootedCondition_NotAlreadyPresent_Test()
        {
            var character = CreateMockCharacter();
            var confused  = new Confused();

            confused.Apply(character);
            var flatFooted = (FlatFooted)character.Conditions.FirstOrDefault(c => c.Id == EntityIds.FLAT_FOOTED_CONDITION_ID);

            Assert.IsNotNull(flatFooted);
            Assert.AreEqual(EntityIds.FLAT_FOOTED_CONDITION_ID, flatFooted.Id);
            Assert.AreEqual(1, flatFooted.FlatFootedFrom.Count);
            Assert.AreEqual(FlatFooted.AllCharacters, flatFooted.FlatFootedFrom[0]);
        }
Пример #6
0
        public void Apply_Character_AddsFlatFootedCondition_AlreadyPresentButNotAllCharacters_Test()
        {
            var character          = CreateMockCharacter();
            var existingFlatFooted = new FlatFooted(1, 2, 3);
            var confused           = new Confused();

            confused.Apply(character);
            var flatFooted = (FlatFooted)character.Conditions.FirstOrDefault(c => c.Id == EntityIds.FLAT_FOOTED_CONDITION_ID);

            Assert.IsNotNull(flatFooted);
            Assert.AreEqual(EntityIds.FLAT_FOOTED_CONDITION_ID, flatFooted.Id);
            Assert.AreEqual(4, flatFooted.FlatFootedFrom.Count);
            Assert.IsTrue(flatFooted.FlatFootedFrom.Contains(FlatFooted.AllCharacters));
            Assert.IsTrue(flatFooted.FlatFootedFrom.Contains(1));
            Assert.IsTrue(flatFooted.FlatFootedFrom.Contains(2));
            Assert.IsTrue(flatFooted.FlatFootedFrom.Contains(3));
        }
Пример #7
0
        public void Remove_Character_FlatFootedAlreadyExists_Test()
        {
            var character          = CreateMockCharacter();
            var existingFlatFooted = new FlatFooted(1, 2, 3);
            var confused           = new Confused();

            existingFlatFooted.Apply(character);
            confused.Apply(character);
            confused.Remove(character);
            var flatFooted = (FlatFooted)character.Conditions.FirstOrDefault(c => c.Id == EntityIds.FLAT_FOOTED_CONDITION_ID);

            Assert.IsNotNull(flatFooted);
            Assert.AreEqual(EntityIds.FLAT_FOOTED_CONDITION_ID, flatFooted.Id);
            Assert.AreEqual(3, flatFooted.FlatFootedFrom.Count);
            Assert.IsTrue(flatFooted.FlatFootedFrom.Contains(1));
            Assert.IsTrue(flatFooted.FlatFootedFrom.Contains(2));
            Assert.IsTrue(flatFooted.FlatFootedFrom.Contains(3));
        }