Exemplo n.º 1
0
        public void Apply_NotACharacter_Test()
        {
            var entity     = Mock.Of <IEntity>();
            var flatFooted = new FlatFooted();

            flatFooted.Apply(entity);
            Assert.IsTrue(true); // If we made it here without exception then the test passed
        }
Exemplo n.º 2
0
        public void Remove_Character_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted(1, 2, 3);

            flatFooted.Apply(character);
            flatFooted.Remove(character);
            Assert.AreEqual(0, character.Conditions.Count);
        }
Exemplo n.º 3
0
        public void Apply_Character_WithExistingFlatFootedCondition_Test()
        {
            var character = CreateMockCharacter();

            character.Conditions.Add(new FlatFooted());
            var flatFooted = new FlatFooted();

            flatFooted.Apply(character);
        }
Exemplo n.º 4
0
        public void Apply_Character_NoConditions_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted();

            flatFooted.Apply(character);
            Assert.AreEqual(EntityIds.FLAT_FOOTED_CONDITION_ID, character.Conditions[0].Id);
            Assert.AreSame(flatFooted, character.Conditions[0]);
            Assert.AreEqual(ModifierType.Circumstance, character.Conditions[0].Modifier.Type);
            Assert.AreEqual(-2, character.Conditions[0].Modifier.Value);
        }
Exemplo n.º 5
0
        public void Remove_WithExistingFlatFootedToOne_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted(1);

            flatFooted.Apply(character);
            var prone = new Prone();

            prone.Apply(character);
            prone.Remove(character);
            Assert.AreEqual(0, character.Conditions.Count);
        }
Exemplo n.º 6
0
        public void Remove_FlatFootedToOneExists_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted(1);

            flatFooted.Apply(character);
            var restrained = new Restrained();

            restrained.Apply(character);
            restrained.Remove(character);
            Assert.AreEqual(0, character.Conditions.Count);
        }
Exemplo n.º 7
0
        public void Remove_WithExistingFlatFootedToAll_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted(FlatFooted.AllCharacters);

            flatFooted.Apply(character);
            var prone = new Prone();

            prone.Apply(character);
            prone.Remove(character);
            Assert.AreEqual(1, character.Conditions.Count);
            Assert.AreSame(flatFooted, character.Conditions[0]);
        }
Exemplo n.º 8
0
        public void Apply_Character_FlatFootedToAllExists_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted(FlatFooted.AllCharacters);

            flatFooted.Apply(character);
            var restrained = new Restrained();

            restrained.Apply(character);
            var newFlatFooted = (FlatFooted)character.Conditions.First(c => c.Id == EntityIds.FLAT_FOOTED_CONDITION_ID);

            Assert.AreSame(flatFooted, newFlatFooted);
        }
Exemplo n.º 9
0
        public void Remove_FlatFootedToAllExists_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted(FlatFooted.AllCharacters);

            flatFooted.Apply(character);
            var restrained = new Restrained();

            restrained.Apply(character);
            restrained.Remove(character);
            Assert.AreEqual(1, character.Conditions.Count);
            Assert.IsTrue(character.Conditions.Contains(flatFooted));
        }
Exemplo n.º 10
0
        public void Constructor_Remove_MultipleFlatFootedTo_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted(1, 2, 3);

            flatFooted.Apply(character);
            var flatFootedReplacement = new FlatFooted(flatFooted, true, 1, 3);

            flatFooted.Remove(character);
            flatFootedReplacement.Apply(character);
            Assert.AreEqual(1, character.Conditions.Count);
            Assert.AreEqual(1, ((FlatFooted)character.Conditions[0]).FlatFootedFrom.Count);
            Assert.IsTrue(((FlatFooted)character.Conditions[0]).FlatFootedFrom.Contains(2));
        }
Exemplo n.º 11
0
        public void Apply_Character_FlatFootedToOneExists_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted(1);

            flatFooted.Apply(character);
            var restrained = new Restrained();

            restrained.Apply(character);
            var newFlatFooted = (FlatFooted)character.Conditions.First(c => c.Id == EntityIds.FLAT_FOOTED_CONDITION_ID);

            Assert.AreNotSame(flatFooted, newFlatFooted);
            Assert.IsFalse(newFlatFooted.FlatFootedFrom.Contains(1));
            Assert.IsTrue(newFlatFooted.FlatFootedFrom.Contains(FlatFooted.AllCharacters));
        }
Exemplo n.º 12
0
        public void Construct_AddSingleFlatFootedTo_Test()
        {
            var character  = CreateMockCharacter();
            var flatFooted = new FlatFooted(1, 2, 3);

            flatFooted.Apply(character);
            var flatFootedReplacement = new FlatFooted(flatFooted, false, 4);

            flatFooted.Remove(character);
            flatFootedReplacement.Apply(character);
            Assert.AreEqual(1, character.Conditions.Count);
            Assert.AreEqual(4, ((FlatFooted)character.Conditions[0]).FlatFootedFrom.Count);
            Assert.IsTrue(((FlatFooted)character.Conditions[0]).FlatFootedFrom.Contains(1));
            Assert.IsTrue(((FlatFooted)character.Conditions[0]).FlatFootedFrom.Contains(2));
            Assert.IsTrue(((FlatFooted)character.Conditions[0]).FlatFootedFrom.Contains(3));
            Assert.IsTrue(((FlatFooted)character.Conditions[0]).FlatFootedFrom.Contains(4));
        }
Exemplo n.º 13
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));
        }