예제 #1
0
 public void GridPaintPaletteWindow_IsLoadedFromDll()
 {
     Assert.That(typeof(GridPaintPaletteWindow).Assembly.FullName, Contains.Substring("Unity.2D.Tilemap.Editor"));
 }
예제 #2
0
        private void VerifyEquipment(Creature creature)
        {
            Assert.That(creature.Equipment, Is.Not.Null, creature.Summary);

            if (!creature.CanUseEquipment)
            {
                Assert.That(creature.Equipment.Weapons, Is.Empty, creature.Summary);
                Assert.That(creature.Equipment.Items, Is.Empty, creature.Summary);

                if (creature.Name == CreatureConstants.HellHound_NessianWarhound)
                {
                    Assert.That(creature.Equipment.Armor, Is.Not.Null, creature.Summary);
                }
                else
                {
                    Assert.That(creature.Equipment.Armor, Is.Null, creature.Summary);
                }
            }

            var armorNames  = ArmorConstants.GetAllArmors(true);
            var shieldNames = ArmorConstants.GetAllShields(true);
            var weaponNames = WeaponConstants.GetAllWeapons(true, false);

            if (creature.Equipment.Armor != null)
            {
                Assert.That(creature.Equipment.Armor.ArmorBonus, Is.Positive, creature.Summary + creature.Equipment.Armor.Name);
                Assert.That(armorNames, Contains.Item(creature.Equipment.Armor.Name), creature.Summary + creature.Equipment.Armor.Name);
            }

            if (creature.Equipment.Shield != null)
            {
                Assert.That(creature.Equipment.Shield.ArmorBonus, Is.Positive, creature.Summary + creature.Equipment.Shield.Name);
                Assert.That(shieldNames, Contains.Item(creature.Equipment.Shield.Name), creature.Summary + creature.Equipment.Shield.Name);
            }

            var unnaturalAttacks = creature.Attacks.Where(a => !a.IsNatural && creature.Equipment.Weapons.Any(w => a.Name.StartsWith(w.Description)));

            foreach (var attack in unnaturalAttacks)
            {
                Weapon weapon = null;

                //INFO: Lycanthropes have a modifed name for the attack based on their form
                if (creature.Template.Contains("Lycanthrope"))
                {
                    weapon = creature.Equipment.Weapons.FirstOrDefault(w => attack.Name.StartsWith($"{w.Description} ("));
                }
                else
                {
                    weapon = creature.Equipment.Weapons.FirstOrDefault(w => attack.Name == w.Description);
                }

                Assert.That(weapon, Is.Not.Null, $"{creature.Summary}: {attack.Name}");
                Assert.That(weapon.DamageDescription, Is.Not.Empty, $"{creature.Summary}: {weapon.Description}");
                Assert.That(weaponNames, Contains.Item(weapon.Name), $"{creature.Summary}: {weapon.Description}");

                Assert.That(attack.Damages, Is.Not.Empty.And.Count.EqualTo(weapon.Damages.Count));

                for (var i = 0; i < weapon.Damages.Count; i++)
                {
                    if (i == 0)
                    {
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Roll), $"{creature.Summary}; Weapon: {weapon.Description}");
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Type), $"{creature.Summary}; Weapon: {weapon.Description}");
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Condition), $"{creature.Summary}; Weapon: {weapon.Description}");
                    }
                    else
                    {
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Description), $"{creature.Summary}; Weapon: {weapon.Description}");
                    }
                }

                if (weapon.Attributes.Contains(AttributeConstants.Melee))
                {
                    Assert.That(attack.AttackType, Contains.Substring("melee"), $"{creature.Summary}: {weapon.Description}");
                }
                else if (weapon.Attributes.Contains(AttributeConstants.Ranged))
                {
                    Assert.That(attack.AttackType, Contains.Substring("ranged"), $"{creature.Summary}: {weapon.Description}");
                }
            }
        }
예제 #3
0
        private void AssertAttack(Attack attack, Creature creature)
        {
            var message = $"Creature: {creature.Summary}; Attack: {attack.Name}";
            var meleeEquipmentAttacks = creature.Attacks.Where(a => a.IsMelee &&
                                                               (creature.Equipment.Weapons.Any(w => a.Name.StartsWith(w.Description)) || a.Name.StartsWith(AttributeConstants.Melee)));
            var rangedEquipmentAttacks = creature.Attacks.Where(a => !a.IsMelee &&
                                                                (creature.Equipment.Weapons.Any(w => a.Name.StartsWith(w.Description)) || a.Name.StartsWith(AttributeConstants.Ranged)));

            Assert.That(attack.Name, Is.Not.Empty, message);
            Assert.That(attack.AttackType, Is.Not.Empty, message);
            Assert.That(attack.BaseAttackBonus, Is.Not.Negative, message);
            Assert.That(attack.Frequency, Is.Not.Null, message);
            Assert.That(attack.Frequency.Quantity, Is.Not.Negative, message);
            Assert.That(attack.Frequency.TimePeriod, Contains.Substring(FeatConstants.Frequencies.Round)
                        .Or.Contains(FeatConstants.Frequencies.Hit)
                        .Or.Contains(FeatConstants.Frequencies.Minute)
                        .Or.Contains(FeatConstants.Frequencies.Hour)
                        .Or.Contains(FeatConstants.Frequencies.Day)
                        .Or.Contains(FeatConstants.Frequencies.Week)
                        .Or.Contains(FeatConstants.Frequencies.Month)
                        .Or.Contains(FeatConstants.Frequencies.Year)
                        .Or.Contains(FeatConstants.Frequencies.Life)
                        .Or.Contains(FeatConstants.Frequencies.AtWill)
                        .Or.Contains(FeatConstants.Frequencies.Constant), message);

            if (!attack.IsNatural)
            {
                Assert.That(creature.CanUseEquipment, Is.True, message);
            }

            if (!attack.IsPrimary &&
                !attack.IsSpecial &&
                !attack.IsNatural &&
                ((meleeEquipmentAttacks.Contains(attack) && meleeEquipmentAttacks.Count() > 1) ||
                 rangedEquipmentAttacks.Contains(attack) && rangedEquipmentAttacks.Count() > 1))
            {
                Assert.That(attack.AttackBonuses, Contains.Item(-10), message);
            }
            else if (!attack.IsPrimary && !attack.IsSpecial)
            {
                Assert.That(attack.AttackBonuses, Contains.Item(-5), message);
            }

            if (!attack.IsSpecial)
            {
                Assert.That(attack.BaseAbility, Is.Not.Null, message);
                Assert.That(creature.Abilities.Values, Contains.Item(attack.BaseAbility), message);

                if (attack.IsNatural)
                {
                    Assert.That(attack.DamageDescription, Is.Not.Empty, message);
                }
            }

            if (attack.Save != null)
            {
                if (attack.IsNatural && attack.Save.BaseAbility != null)
                {
                    Assert.That(creature.Abilities.Values, Contains.Item(attack.Save.BaseAbility), message);
                }

                Assert.That(attack.Save.BaseValue, Is.Positive, message);
                Assert.That(attack.Save.DC, Is.Positive, message);
                Assert.That(attack.Save.Save, Is.EqualTo(SaveConstants.Fortitude)
                            .Or.EqualTo(SaveConstants.Reflex)
                            .Or.EqualTo(SaveConstants.Will)
                            .Or.Empty, message);
            }

            var clawDamage = $"{AttributeConstants.DamageTypes.Piercing}/{AttributeConstants.DamageTypes.Slashing}";
            var biteDamage = $"{AttributeConstants.DamageTypes.Piercing}/{AttributeConstants.DamageTypes.Slashing}/{AttributeConstants.DamageTypes.Bludgeoning}";

            Weapon weapon = null;

            //INFO: Lycanthropes have a modifed name for the attack based on their form
            if (creature.Template.Contains("Lycanthrope"))
            {
                weapon = creature.Equipment.Weapons.FirstOrDefault(w => attack.Name.StartsWith($"{w.Description} ("));
            }
            else
            {
                weapon = creature.Equipment.Weapons.FirstOrDefault(w => attack.Name == w.Description);
            }

            if (weapon != null)
            {
                Assert.That(attack.Damages,
                            Is.Not.Empty.And.Count.EqualTo(weapon.Damages.Count),
                            $"{message}; Weapon: {weapon.Description} ({weapon.DamageDescription}); Attack Damage: {attack.DamageDescription}");

                for (var i = 0; i < weapon.Damages.Count; i++)
                {
                    if (i == 0)
                    {
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Roll), $"{message}; Weapon: {weapon.Description}");
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Type), $"{message}; Weapon: {weapon.Description}");
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Condition), $"{message}; Weapon: {weapon.Description}");
                    }
                    else
                    {
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Description), $"{message}; Weapon: {weapon.Description}");
                    }
                }

                return;
            }

            foreach (var damage in attack.Damages)
            {
                Assert.That(damage.Roll, Is.Not.Empty);
                Assert.That(damage.Type, Is.Empty
                            .Or.EqualTo(clawDamage)
                            .Or.EqualTo(biteDamage)
                            .Or.EqualTo(AttributeConstants.DamageTypes.Bludgeoning)
                            .Or.EqualTo(AttributeConstants.DamageTypes.Piercing)
                            .Or.EqualTo(AttributeConstants.DamageTypes.Slashing)
                            .Or.EqualTo(FeatConstants.Foci.Elements.Acid)
                            .Or.EqualTo(FeatConstants.Foci.Elements.Fire)
                            .Or.EqualTo(FeatConstants.Foci.Elements.Electricity)
                            .Or.EqualTo(FeatConstants.Foci.Elements.Cold)
                            .Or.EqualTo(FeatConstants.Foci.Elements.Sonic)
                            .Or.EqualTo(AbilityConstants.Charisma)
                            .Or.EqualTo(AbilityConstants.Constitution)
                            .Or.EqualTo(AbilityConstants.Dexterity)
                            .Or.EqualTo(AbilityConstants.Intelligence)
                            .Or.EqualTo(AbilityConstants.Strength)
                            .Or.EqualTo(AbilityConstants.Wisdom)
                            .Or.EqualTo("Negative Level")
                            .Or.EqualTo("Positive energy")
                            .Or.EqualTo("Ability points (of ghost's choosing)"), $"{message}; Damage: {damage.Description}");
            }
        }
예제 #4
0
 public void CanProcessDecimals()
 {
     _controller.AcceptCharacter('.');
     Assert.That(_controller.GetOutput(), Contains.Substring("."));
 }
예제 #5
0
            public void FailsOnSinglesOutsideOfRelativeTolerance(object value)
            {
                var ex = Assert.Throws <AssertionException>(() => Assert.That(value, new EqualConstraint(10000.0f).Within(10.0f).Percent));

                Assert.That(ex.Message, Contains.Substring("+/- 10.0f Percent"));
            }
        public void PropertiesEqual_PrivatePropertiesShouldBeIgnored_InTheActualObject()
        {
            var ex = Assert.Throws <AssertionException>(() => Assert.That(new TestObject1PrivateProperty(), Properties.Equal(new TestObject1Property())));

            Assert.That(ex.Message, Contains.Substring("Expected contains the following properties which actual is missing: StringProperty"));
        }
예제 #7
0
        public async Task Limit_is_correctly_added_to_queryString([Frozen] IHttpRestClient client, IHubSpotCrmAssociationClient sut, long objectId, int associationTypeId, [System.ComponentModel.DataAnnotations.Range(1, 100)] int limit)
        {
            Assume.That(limit <= 100);

            var response = await sut.GetAllAsync(objectId, associationTypeId, limit);

            Mock.Get(client)
            .Verify(p => p.SendAsync <AssociationIdList>(HttpMethod.Get, $"/crm-associations/v1/associations/{objectId}/HUBSPOT_DEFINED/{associationTypeId}", QueryStringMatcher.That(Contains.Substring($"limit={limit}"))));
        }
예제 #8
0
 public void _4_ShouldHaveAButton()
 {
     Assert.That(_button, Is.Not.Null, () => "Could not find a Button control");
     Assert.That(_button.Content, Contains.Substring("bereken").IgnoreCase, () => "The 'Content' of the button should be 'Bereken'");
 }
예제 #9
0
        public void TestBuiltInPlugInsUrl()
        {
            var main = CFBundle.GetMain();

            Assert.That(main.BuiltInPlugInsUrl.ToString(), Contains.Substring("PlugIns/"));
        }
 public void testAssertBothContainString()
 {
     Assert.That("richard", Does.Contain("a").And.Contain("d"));
     Assert.That("richard", Contains.Substring("a").And.Contain("d"));
 }
예제 #11
0
 public void TestNameWithInvalidCharacter()
 {
     testMethod.Name = "\u0001HappyFace";
     // This throws if the name is not properly escaped
     Assert.That(testMethod.ToXml(false).OuterXml, Contains.Substring("name=\"\\u0001HappyFace\""));
 }
예제 #12
0
            public void Run(RegressionEnvironment env)
            {
                TryInvalidContains(
                    env,
                    "expression js:abc[dummy abc = 1;] select * from SupportBean",
                    "Error during compilation: SyntaxError: Unexpected identifier");
                    //"Expected ';'");

                TryInvalidContains(
                    env,
                    "expression js:abc(aa) [return aa..bb(1);] select abc(1) from SupportBean",
                    "Error during compilation: SyntaxError: Unexpected token '.'");
                    //"Expected identifier");

                TryInvalidCompile(
                    env,
                    "expression js:abc[] select * from SupportBean",
                    "Incorrect syntax near ']' at line 1 column 18 near reserved keyword 'select' [expression js:abc[] select * from SupportBean]");

                // empty script
                env.CompileDeploy("expression js:abc[\n] select * from SupportBean");

                // execution problem
                env.UndeployAll();
                env.CompileDeploy(
                    "expression js:abc() [throw new Error(\"Some error\");] select * from SupportBean#keepall where abc() = 1");
                try {
                    env.SendEventBean(new SupportBean());
                    Assert.Fail();
                }
                catch (Exception ex) {
                    Assert.That(ex.Message, Contains.Substring("Unexpected exception executing script 'abc':"));
                }

                // execution problem
                env.UndeployAll();
                env.CompileDeploy("expression js:abc[dummy;] select * from SupportBean#keepall where abc() = 1");
                try {
                    env.SendEventBean(new SupportBean());
                    Assert.Fail();
                }
                catch (Exception ex) {
                    Assert.That(ex.Message, Contains.Substring("Unexpected exception executing script 'abc':"));
                }

                // execution problem
                env.UndeployAll();
                env.CompileDeploy(
                        "@Name('ABC') expression int[] js:callIt() [ var myarr = new Array(2, 8, 5, 9); return myarr; ]" +
                        " select callIt().countOf(v => v < 6) from SupportBean")
                    .AddListener("ABC");
                try {
                    env.SendEventBean(new SupportBean());
                    Assert.Fail();
                }
                catch (Exception ex) {
                    Assert.That(ex.Message, Contains.Substring("Unexpected exception in statement 'ABC': "));
                }

                env.UndeployAll();
            }
예제 #13
0
 public void ThenTheTitleShouldBe(string expectedResult)
 {
     Assert.That(expectedResult, Contains.Substring(_actualResult));
 }
예제 #14
0
 private void AssertResultContainsSubstring(string expected)
 {
     Assert.That(this.generatedCode, Contains.Substring(expected));
 }
 private void ThenLevel1ShouldBeView()
 {
     ThenLevel0ShouldBeSchema();
     Assert.That(_op.ToQuery(), Contains.Substring(string.Format("@level1type=N'VIEW', @level1name='{0}'", _op.TableViewName)));
 }
예제 #16
0
        public void TestSharedFrameworksUrl()
        {
            var main = CFBundle.GetMain();

            Assert.That(main.SharedFrameworksUrl.ToString(), Contains.Substring("SharedFrameworks/"));
        }
 private void ThenLevel2ShouldBeColumn()
 {
     Assert.That(_op.ToQuery(), Contains.Substring(string.Format("@level2type=N'COLUMN', @level2name='{0}'", _op.ColumnName)));
 }
예제 #18
0
        public void TestSharedSupportUrl()
        {
            var main = CFBundle.GetMain();

            Assert.That(main.SharedSupportUrl.ToString(), Contains.Substring("SharedSupport/"));
        }
        public void PropertiesEqual_IfTheActualObjectIsMissingProperties_WhichExpectedObjectContains_ReturnsError()
        {
            var ex = Assert.Throws <AssertionException>(() => Assert.That(new TestObject1Property(), Properties.Equal(new TestObject3Property())));

            Assert.That(ex.Message, Contains.Substring("Expected contains the following properties which actual is missing: IntProperty, FloatProperty"));
        }
예제 #20
0
        public void TestSupportFilesDirectoryUrl()
        {
            var main = CFBundle.GetMain();

            Assert.That(main.SupportFilesDirectoryUrl.ToString(), Contains.Substring(ExpectedAppName + "/"));
        }
예제 #21
0
        public async Task Offset_is_correctly_added_to_queryString([Frozen] IHttpRestClient client, IHubSpotCrmAssociationClient sut, long objectId, int associationTypeId, long offset)
        {
            var response = await sut.GetAllAsync(objectId, associationTypeId, offset : offset);

            Mock.Get(client)
            .Verify(p => p.SendAsync <AssociationIdList>(HttpMethod.Get, $"/crm-associations/v1/associations/{objectId}/HUBSPOT_DEFINED/{associationTypeId}", QueryStringMatcher.That(Contains.Substring($"offset={offset}"))));
        }
예제 #22
0
        public void TestUrl()
        {
            var main = CFBundle.GetMain();

            Assert.That(main.Url.ToString(), Contains.Substring(ExpectedAppName + "/"));
        }
예제 #23
0
            public void FailsOnSinglesOutsideOfUlpTolerance(object value)
            {
                var ex = Assert.Throws <AssertionException>(() => Assert.That(value, new EqualConstraint(20000000.0f).Within(1).Ulps));

                Assert.That(ex.Message, Contains.Substring("+/- 1 Ulps"));
            }
예제 #24
0
        public async Task AlarmsHaveMeaningfulDescription()
        {
            // arrange
            var config = new WatchmanConfiguration()
            {
                AlertingGroups = new List <AlertingGroup>()
                {
                    new AlertingGroup()
                    {
                        Name            = "group-with-description",
                        AlarmNameSuffix = "group-suffix-1",
                        Description     = "Group description for group 1",
                        Services        = new AlertingGroupServices()
                        {
                            Elb = new AwsServiceAlarms <ResourceConfig>()
                            {
                                Resources = new List <ResourceThresholds <ResourceConfig> >()
                                {
                                    new ResourceThresholds <ResourceConfig>()
                                    {
                                        Name = "elb-1"
                                    }
                                }
                            }
                        }
                    },


                    new AlertingGroup()
                    {
                        Name            = "group-without-description",
                        AlarmNameSuffix = "group-suffix-2",
                        Services        = new AlertingGroupServices()
                        {
                            Elb = new AwsServiceAlarms <ResourceConfig>()
                            {
                                Resources = new List <ResourceThresholds <ResourceConfig> >()
                                {
                                    new ResourceThresholds <ResourceConfig>()
                                    {
                                        Name = "elb-2"
                                    }
                                }
                            }
                        }
                    }
                }
            };

            var fakeCloudFormation = new FakeCloudFormation();
            var ioc = new TestingIocBootstrapper()
                      .WithCloudFormation(fakeCloudFormation.Instance)
                      .WithConfig(config);

            ioc.GetMock <IAmazonElasticLoadBalancing>().DescribeReturnsLoadBalancers(new[]
            {
                new LoadBalancerDescription()
                {
                    LoadBalancerName = "elb-1"
                },
                new LoadBalancerDescription()
                {
                    LoadBalancerName = "elb-2"
                }
            });

            var sut = ioc.Get <AlarmLoaderAndGenerator>();

            // act

            await sut.LoadAndGenerateAlarms(RunMode.GenerateAlarms);

            // assert

            var firstGroupAlarm = fakeCloudFormation
                                  .Stack("Watchman-group-with-description")
                                  .Alarms()
                                  .First();

            var description = firstGroupAlarm.Properties["AlarmDescription"].ToString();

            Assert.That(description, Contains.Substring("Alarm generated by AwsWatchman"));
            Assert.That(description, Contains.Substring("group-with-description"));
            Assert.That(description, Contains.Substring("Group description for group 1"));

            var secondGroupAlarm = fakeCloudFormation
                                   .Stack("Watchman-group-without-description")
                                   .Alarms()
                                   .First();

            var description2 = secondGroupAlarm.Properties["AlarmDescription"].ToString();

            Assert.That(description2, Contains.Substring("Alarm generated by AwsWatchman"));
            Assert.That(description2, Contains.Substring("group-without-description"));
        }
예제 #25
0
        public void ToStringReflectsTheState()
        {
            var inclusive = true;
            var offset    = 123;
            var sequence  = 778;
            var enqueued  = DateTimeOffset.Now.AddHours(1);

            Assert.That(EventPosition.Earliest.ToString(), Contains.Substring(nameof(EventPosition.Earliest)), "Earliest should be represented.");
            Assert.That(EventPosition.Latest.ToString(), Contains.Substring(nameof(EventPosition.Latest)), "Latest should be represented.");
            Assert.That(EventPosition.FromOffset(offset).ToString(), Contains.Substring($"[{ offset }]"), "The offset should be represented.");
            Assert.That(EventPosition.FromSequenceNumber(sequence).ToString(), Contains.Substring($"[{ sequence }]"), "The sequence should be represented.");
            Assert.That(EventPosition.FromEnqueuedTime(enqueued).ToString(), Contains.Substring($"[{ enqueued }]"), "The enqueued time should be represented.");
            Assert.That(EventPosition.FromOffset(offset, inclusive).ToString(), Contains.Substring($"[{ inclusive }]"), "The inclusive flag should be represented for the offset.");
            Assert.That(EventPosition.FromSequenceNumber(sequence, inclusive).ToString(), Contains.Substring($"[{ inclusive }]"), "The inclusive flag should be represented for the sequence number.");
        }
 private void ThenValueInQueryShouldBe(string value)
 {
     Assert.That(_op.ToQuery(), Contains.Substring(string.Format("@value={0}", value)));
 }
예제 #27
0
        private void VerifyCombat(Creature creature)
        {
            Assert.That(creature.BaseAttackBonus, Is.Not.Negative, creature.Summary);

            //INFO: Hit Dice can be empty, if the creature was generated as a character

            foreach (var hitDice in creature.HitPoints.HitDice)
            {
                Assert.That(hitDice.Quantity, Is.Positive, creature.Summary);
                Assert.That(hitDice.RoundedQuantity, Is.Positive, creature.Summary);
                Assert.That(hitDice.HitDie, Is.EqualTo(6)
                            .Or.EqualTo(8)
                            .Or.EqualTo(10)
                            .Or.EqualTo(12), creature.Summary);
                Assert.That(hitDice.Divisor, Is.Positive, creature.Summary);
                Assert.That(hitDice.DefaultRoll, Contains.Substring($"{hitDice.RoundedQuantity}d{hitDice.HitDie}"), creature.Summary);

                Assert.That(creature.HitPoints.DefaultRoll, Contains.Substring($"{hitDice.RoundedQuantity}d{hitDice.HitDie}"), creature.Summary);
            }

            Assert.That(creature.HitPoints.HitDiceQuantity, Is.Not.Negative, creature.Summary);
            Assert.That(creature.HitPoints.RoundedHitDiceQuantity, Is.Not.Negative
                        .And.AtLeast(creature.HitPoints.HitDice.Count), creature.Summary);

            Assert.That(creature.HitPoints.Total, Is.Not.Negative
                        .And.AtLeast(creature.HitPoints.RoundedHitDiceQuantity), creature.Summary);
            Assert.That(creature.HitPoints.DefaultTotal, Is.Not.Negative
                        .And.AtLeast(creature.HitPoints.RoundedHitDiceQuantity), creature.Summary);

            Assert.That(creature.FullMeleeAttack, Is.Not.Null, creature.Summary);
            Assert.That(creature.FullRangedAttack, Is.Not.Null, creature.Summary);

            if (creature.MeleeAttack != null)
            {
                Assert.That(creature.MeleeAttack.IsMelee, Is.True, creature.Summary);
                Assert.That(creature.MeleeAttack.IsSpecial, Is.False, creature.Summary);
                Assert.That(creature.FullMeleeAttack, Is.Not.Empty, creature.Summary);
                Assert.That(creature.FullMeleeAttack.All(a => a.IsMelee && !a.IsSpecial), Is.True, creature.Summary);
            }

            if (creature.RangedAttack != null)
            {
                Assert.That(creature.RangedAttack.IsMelee, Is.False, creature.Summary);
                Assert.That(creature.RangedAttack.IsSpecial, Is.False, creature.Summary);
                Assert.That(creature.FullRangedAttack, Is.Not.Empty, creature.Summary);
                Assert.That(creature.FullRangedAttack.All(a => !a.IsMelee && !a.IsSpecial), Is.True, creature.Summary);
            }

            foreach (var attack in creature.Attacks)
            {
                AssertAttack(attack, creature);
            }

            Assert.That(creature.ArmorClass.TotalBonus, Is.Positive, creature.Summary);
            Assert.That(creature.ArmorClass.FlatFootedBonus, Is.Positive, creature.Summary);
            Assert.That(creature.ArmorClass.TouchBonus, Is.Positive, creature.Summary);

            Assert.That(creature.InitiativeBonus, Is.Not.Negative, creature.Summary);

            if (creature.Abilities[AbilityConstants.Dexterity].HasScore)
            {
                Assert.That(creature.TotalInitiativeBonus, Is.AtLeast(creature.Abilities[AbilityConstants.Dexterity].Modifier), creature.Summary);
            }
            else
            {
                Assert.That(creature.TotalInitiativeBonus, Is.AtLeast(creature.Abilities[AbilityConstants.Intelligence].Modifier), creature.Summary);
            }

            Assert.That(creature.Saves[SaveConstants.Reflex].TotalBonus, Is.AtLeast(creature.Abilities[AbilityConstants.Dexterity].Modifier), creature.Summary);
            Assert.That(creature.Saves[SaveConstants.Will].TotalBonus, Is.AtLeast(creature.Abilities[AbilityConstants.Wisdom].Modifier), creature.Summary);
            Assert.That(creature.Saves[SaveConstants.Fortitude].TotalBonus, Is.AtLeast(creature.Abilities[AbilityConstants.Constitution].Modifier), creature.Summary);
        }
 private void ThenLevel0ShouldBeSchema()
 {
     Assert.That(_op.ToQuery(), Contains.Substring(string.Format("@level0type=N'SCHEMA', @level0name=N'{0}'", _op.SchemaName)));
 }
예제 #29
0
        public void AssertPassInBlockThrowsException()
        {
            ITestResult result = CheckResult("AssertPassInBlock", ResultState.Error);

            Assert.That(result.Message, Contains.Substring("Assert.Pass may not be used in a multiple assertion block."));
        }
예제 #30
0
 public void TurnOff_WasOn_CorrectOutput()
 {
     _uut.TurnOn(50);
     _uut.TurnOff();
     Assert.That(_stw.ToString, Contains.Substring("off"));
 }