Example #1
0
        public void UpdateSkill(SkillUpdateRequest skillUpdateRequest)
        {
            _logger.LogEntry();

            var cachedSkill = CachedSvcSkills[skillUpdateRequest.Id];

            cachedSkill.Ranks = skillUpdateRequest.Ranks;
            cachedSkill.Class = skillUpdateRequest.Class;
            _skillTotalCalculator.AddTotal(cachedSkill);

            SkillsUpdated?.Invoke(this, EventArgs.Empty);

            _logger.LogExit();
        }
        public void UpdateSkill_CalculatesTotalForUpdatedSkill()
        {
            //Arrange
            var guid = Guid.NewGuid();

            _skillsService.CachedSvcSkills = new Dictionary <Guid, API.Dto.Skill>
            {
                { guid, new API.Dto.Skill {
                      Id = guid, Ranks = 0
                  } }
            };

            //Act
            _skillsService.UpdateSkill(new SkillUpdateRequest {
                Id = guid, Ranks = 4
            });

            //Assert
            A.CallTo(() => _skillTotalCalculator.AddTotal(A <API.Dto.Skill> .That.Matches(skill =>
                                                                                          skill.Id == guid &&
                                                                                          skill.Ranks == 4))).MustHaveHappened();
        }