Exemplo n.º 1
0
        public IsProficientCM buildIsProficientCM(Guid Character_id)
        {
            IsProficient foundRecord = _userAccess.GetProficiencyRecord(Character_id);
            ReadModelMapper <IsProficient, IsProficientCM> mapper = new ReadModelMapper <IsProficient, IsProficientCM>();
            IsProficientCM cm = mapper.mapDataModelToViewModel(foundRecord);

            return(cm);
        }
        public static IsProficientCM mapIsProficientToIsProficientCM(IsProficient m)
        {
            ReadModelMapper <IsProficient, IsProficientCM> mapper = new ReadModelMapper <IsProficient, IsProficientCM>();
            IsProficientCM cm = new IsProficientCM();

            mapper.mapDataModelToViewModel(m, cm);
            return(cm);
        }
Exemplo n.º 3
0
        public void CharacterMapper_MapIsProficientToIsProficientCM_ValidCall()
        {
            //Arrange
            var record = CreateTestData.GetSampleIsProficient();
            var actual = new IsProficientCM();

            //Act
            actual = CharacterMapper.mapIsProficientToIsProficientCM(record);

            //Assert
            actual.Should().BeEquivalentTo(record,
                                           options => options.Excluding(o => o.Character_id));
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public SkillBonusCM buildSkillBonusCM(StatBonusCM statBonus, int totalLevel, IsProficientCM proficiencies)
        {
            SkillBonusCM skillBonus      = new SkillBonusCM();
            int          proficienyBonus = totalLevel / 4;

            //str
            skillBonus.Athletics = calcSkillBonus(statBonus.Strength, proficienyBonus, proficiencies.Athletics);

            //dex
            skillBonus.Acrobatics    = calcSkillBonus(statBonus.Dexterity, proficienyBonus, proficiencies.Acrobatics);
            skillBonus.Stealth       = calcSkillBonus(statBonus.Dexterity, proficienyBonus, proficiencies.Stealth);
            skillBonus.SleightOfHand = calcSkillBonus(statBonus.Dexterity, proficienyBonus, proficiencies.SleightOfHand);

            //con
            // no skills for constitution

            //int
            skillBonus.Arcana        = calcSkillBonus(statBonus.Intelligence, proficienyBonus, proficiencies.Arcana);
            skillBonus.History       = calcSkillBonus(statBonus.Intelligence, proficienyBonus, proficiencies.History);
            skillBonus.Investigation = calcSkillBonus(statBonus.Intelligence, proficienyBonus, proficiencies.Investigation);
            skillBonus.Nature        = calcSkillBonus(statBonus.Intelligence, proficienyBonus, proficiencies.Nature);
            skillBonus.Religion      = calcSkillBonus(statBonus.Intelligence, proficienyBonus, proficiencies.Religion);

            //wis
            skillBonus.AnimalHandling = calcSkillBonus(statBonus.Wisdom, proficienyBonus, proficiencies.AnimalHandling);
            skillBonus.Insight        = calcSkillBonus(statBonus.Wisdom, proficienyBonus, proficiencies.Insight);
            skillBonus.Medicine       = calcSkillBonus(statBonus.Wisdom, proficienyBonus, proficiencies.Medicine);
            skillBonus.Perception     = calcSkillBonus(statBonus.Wisdom, proficienyBonus, proficiencies.Perception);
            skillBonus.Survival       = calcSkillBonus(statBonus.Wisdom, proficienyBonus, proficiencies.Survival);

            //cha
            skillBonus.Deception    = calcSkillBonus(statBonus.Charisma, proficienyBonus, proficiencies.Deception);
            skillBonus.Intimidation = calcSkillBonus(statBonus.Charisma, proficienyBonus, proficiencies.Intimidation);
            skillBonus.Performance  = calcSkillBonus(statBonus.Charisma, proficienyBonus, proficiencies.Performance);
            skillBonus.Persuasion   = calcSkillBonus(statBonus.Charisma, proficienyBonus, proficiencies.Persuasion);

            return(skillBonus);
        }
        private IsProficient mapIsProficient(IsProficientCM cm)
        {
            CreateModelMapper <IsProficientCM, IsProficient> skillMapper = new CreateModelMapper <IsProficientCM, IsProficient>();

            return(skillMapper.mapViewModelToDataModel(cm));
        }
Exemplo n.º 7
0
        public void CMBUilder_buildSkillBonusCM()
        {
            //Arrange
            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
            };
            int totalLevel = 12;
            var expected   = 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 CalebStats = new Stats()
            {
                Character_id = Guid.Parse("361bd911-0702-437f-ab59-a29da0f9fba4"),
                Strength     = 10,
                Dexterity    = 12,
                Constitution = 16,
                Intelligence = 20,
                Wisdom       = 5,
                Charisma     = 16
            };

            using (var mockAccess = AutoMock.GetLoose())
            {
                var Caleb_id = Guid.Parse("361bd911-0702-437f-ab59-a29da0f9fba4");
                mockAccess.Mock <IBaseUserAccess>()
                .Setup(x => x.GetStatsRecord(Caleb_id)).Returns(CalebStats);

                //Act
                //Act
                var access = mockAccess.Create <IBaseUserAccess>();
                ICharacterCMBuilder toTest = ProcessorFactory.GetCharacterCMBuilder(access);
                var actual = toTest.buildSkillBonusCM(statBonus, totalLevel, proficiencies);

                //Assert
                actual.Should().BeEquivalentTo(expected);
            }
        }
Exemplo n.º 8
0
        public void CMBUilder_buildIsProficientCM()
        {
            Guid         Caleb_id    = Guid.Parse("361bd911-0702-437f-ab59-a29da0f9fba4");
            IsProficient CalebRecord = 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
            };
            IsProficientCM Expected = 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
            };

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

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

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