コード例 #1
0
        public ProficiencyCM buildProficiencyCM(Guid Character_id, StatBonusCM statBonus, int totalLevel)
        {
            ProficiencyCM cm = new ProficiencyCM();

            cm.ProficiencyBonus = totalLevel / 4;

            IsProficientCM isProficient = buildIsProficientCM(Character_id);

            cm.isProficient = isProficient;

            SkillBonusCM skillBonus = buildSkillBonusCM(statBonus, totalLevel, isProficient);

            cm.TotalBonus = skillBonus;

            return(cm);
        }
コード例 #2
0
        public void CMBuilder_buildProficiencyCM()
        {
            var skillBonus = new SkillBonusCM
            {
                Acrobatics     = 1,
                AnimalHandling = -3,
                Arcana         = 8,
                Athletics      = 0,
                Deception      = 6,

                History       = 8,
                Insight       = -3,
                Intimidation  = 3,
                Investigation = 8,
                Medicine      = -3,
                Nature        = 5,

                Perception    = -3,
                Performance   = 3,
                Persuasion    = 3,
                Religion      = 8,
                SleightOfHand = 1,

                Stealth  = 1,
                Survival = -3
            };
            var statBonus = new StatBonusCM
            {
                Strength     = 0,
                Dexterity    = 1,
                Constitution = 3,
                Intelligence = 5,
                Wisdom       = -3,
                Charisma     = 3
            };
            var proficiencies = new IsProficientCM
            {
                Acrobatics     = false,
                AnimalHandling = false,
                Arcana         = true,
                Athletics      = false,
                Deception      = true,

                History       = true,
                Intimidation  = false,
                Investigation = true,
                Medicine      = false,
                Nature        = false,

                Perception    = false,
                Performance   = false,
                Persuasion    = false,
                Religion      = true,
                SleightOfHand = false,

                Stealth  = false,
                Survival = false
            };
            var expected = new ProficiencyCM
            {
                ProficiencyBonus = 3,
                TotalBonus       = skillBonus,
                isProficient     = proficiencies
            };

            var proficiencyRecord = new IsProficient
            {
                Character_id     = Guid.Parse("361bd911-0702-437f-ab59-a29da0f9fba4"),
                StrengthSave     = false,
                DexteritySave    = false,
                ConstitutionSave = true,
                IntelligenceSave = false,
                WisdomSave       = false,
                CharismaSave     = false,

                Acrobatics     = false,
                AnimalHandling = false,
                Arcana         = true,
                Athletics      = false,
                Deception      = true,

                History       = true,
                Intimidation  = false,
                Investigation = true,
                Medicine      = false,
                Nature        = false,

                Perception    = false,
                Performance   = false,
                Persuasion    = false,
                Religion      = true,
                SleightOfHand = false,

                Stealth  = false,
                Survival = false
            };
            var Caleb_id = Guid.Parse("361bd911-0702-437f-ab59-a29da0f9fba4");

            using (var mockAccess = AutoMock.GetLoose())
            {
                mockAccess.Mock <IBaseUserAccess>()
                .Setup(x => x.GetProficiencyRecord(Caleb_id)).Returns(proficiencyRecord);

                //Act
                var access = mockAccess.Create <IBaseUserAccess>();
                ICharacterCMBuilder toTest = ProcessorFactory.GetCharacterCMBuilder(access);
                var actual = toTest.buildProficiencyCM(Caleb_id, statBonus, 12);

                //Assert
                actual.Should().BeEquivalentTo(expected);
            }
        }