예제 #1
0
        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);
        }