public void GetAllSkills()
        {
            var skillList = skillsService.GetAllSkills().ToList();

            Assert.NotNull(skillList);
            Assert.GreaterOrEqual(skillList.Count(), 0);
        }
Beispiel #2
0
        public IEnumerable <UiSkill> RequestSkills()
        {
            _logger.LogEntry();
            var svcSkills = _skillsService.GetAllSkills();
            var uiSkills  = _autoMapper.MapToUi(svcSkills);

            _logger.LogExit();
            return(uiSkills);
        }
Beispiel #3
0
        public HttpResponseMessage GetSkills()
        {
            IEnumerable <SkillModel> result = null;

            try
            {
                var res = _skillsService.GetAllSkills();
                result = Helper.CastObject <IEnumerable <SkillModel> >(res);
            }
            catch (Exception ex)
            {
                _logManager.WriteLog(ex);
            }
            return(ToJson(result));
        }
        public void RequestSkills_GetsFromServiceAndReturnsCorrectly()
        {
            //Arrange
            var svcData = new List <Skill>
            {
                new Skill
                {
                    Id = Guid.NewGuid(),
                    ArmourCheckPenalty    = 1,
                    HasArmourCheckPenalty = true,
                    Name          = "Acro",
                    PrimaryStatId = AbilityType.Cha,
                    Ranks         = 1,
                    Class         = true,
                    UseUntrained  = true,
                    Total         = 3
                }
            };

            var uiSkills = new List <UiSkill>
            {
                new UiSkill
                {
                    ArmourCheckPenalty    = 1,
                    HasArmourCheckPenalty = true,
                    Name            = "Acro",
                    PrimaryStatName = "CHA",
                    Ranks           = "1",
                    Class           = true,
                    UseUntrained    = true,
                    Total           = 3
                }
            };

            A.CallTo(() => _skillsService.GetAllSkills()).Returns(svcData);
            A.CallTo(() => _autoMapper.MapToUi(svcData)).Returns(uiSkills);

            //Act
            var result = _skillTableModel.RequestSkills();

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