public void GetAllPrimaryStats_GetsFromDatabase_TransformsMundaneAttributes()
        {
            //Arrange
            var dbPrimaryStats = new List <PrimaryStat>
            {
                new PrimaryStat
                {
                    Id           = AbilityType.Cha,
                    Name         = "PrimaryStat1",
                    AbilityScore = 12,
                }
            };

            var svcPrimaryStats = new List <API.Dto.PrimaryStat>
            {
                new API.Dto.PrimaryStat
                {
                    Id           = API.Dto.AbilityType.Cha,
                    Name         = "PrimaryStat1",
                    AbilityScore = 12
                }
            };


            A.CallTo(() => _primaryStatsRepo.GetPrimaryStats()).Returns(dbPrimaryStats);
            A.CallTo(() => _svcAutoMapper.MapToSvc(dbPrimaryStats)).Returns(svcPrimaryStats);

            //Act
            var result = _primaryStatsService.GetAllPrimaryStats();

            //Assert
            result.Should().BeEquivalentTo(svcPrimaryStats);
        }
Esempio n. 2
0
        private void PopulatePrimaryStats()
        {
            var dbPrimaryStats  = _primaryStatsRepo.GetPrimaryStats();
            var svcPrimaryStats = _svcAutoMapper.MapToSvc(dbPrimaryStats);

            CachedPrimaryStats = svcPrimaryStats.Select(AddModifierToPrimaryStat).ToDictionary(stat => stat.Id);
        }
Esempio n. 3
0
        private void PopulateSvcSkills()
        {
            var dbSkills  = _skillsRepo.GetSkills();
            var svcSkills = _svcAutoMapper.MapToSvc(dbSkills);

            CachedSvcSkills = _skillTotalCalculator.AddTotals(svcSkills).ToDictionary(skill => skill.Id);
            _logger.LogEntry();
        }
        public void GetAllSkills_GetsFromDatabaseAndAddsTotals()
        {
            //Arrange
            var skillId = Guid.NewGuid();

            var dbSkills = new List <Skill>
            {
                new Skill
                {
                    Id                    = skillId,
                    Name                  = "Skill1",
                    PrimaryStatId         = AbilityType.Cha,
                    HasArmourCheckPenalty = true,
                    Ranks                 = 5,
                    Trained               = true,
                    UseUntrained          = true
                }
            };

            var correctSvcSkills = new List <API.Dto.Skill>
            {
                new API.Dto.Skill
                {
                    Id                    = skillId,
                    Name                  = "Skill1",
                    PrimaryStatId         = API.Dto.AbilityType.Cha,
                    HasArmourCheckPenalty = true,
                    Ranks                 = 5,
                    Class                 = true,
                    UseUntrained          = true
                }
            };

            A.CallTo(() => _skillsRepo.GetSkills()).Returns(dbSkills);
            A.CallTo(() => _svcAutoMapper.MapToSvc(dbSkills)).Returns(correctSvcSkills);
            A.CallTo(() => _skillTotalCalculator.AddTotals(correctSvcSkills)).Returns(correctSvcSkills);

            //Act
            var result = _skillsService.GetAllSkills();

            //Assert
            result.Should().BeEquivalentTo(correctSvcSkills);
        }