Esempio n. 1
0
        public void CanAddMultipleDistinctSkillsToUserAccount()
        {
            var skill      = new FakeSkill(1, "Fake skill 1");
            var otherSkill = new FakeSkill(2, "Fake skill 2");

            var sut = new UserAccount();

            sut.AddSkill(skill, FakeSkillLevel.Default);
            sut.AddSkill(otherSkill, FakeSkillLevel.Default);

            sut.Skills.Count.Should().Be(2);
        }
Esempio n. 2
0
        public void CannotAssignSameSkillTwice()
        {
            var skill = FakeSkill.Default;
            var level = FakeSkillLevel.Default;

            var sut = new UserAccount();

            sut.AddSkill(skill, level);
            sut.AddSkill(skill, level);

            sut.Skills.Count.Should().Be(1);
            sut.Skills.SingleOrDefault(o =>
                                       o.Skill.Id.Equals(skill.Id) && o.Level.Id.Equals(level.Id)
                                       ).Should().NotBeNull();
        }
Esempio n. 3
0
        public void IfUserHasSkillThenUpdateLevel()
        {
            var skill = FakeSkill.Default;

            var oldLevel = FakeSkillLevel.Default;
            var newLevel = new FakeSkillLevel(100, "New fake level");

            var sut = new UserAccount();

            sut.AddSkill(skill, oldLevel);
            sut.AddSkill(skill, newLevel);

            sut.Skills.Count.Should().Be(1);

            sut.Skills.SingleOrDefault(o =>
                                       o.Skill.Id.Equals(skill.Id) && o.Level.Id.Equals(oldLevel.Id)
                                       ).Should().BeNull();

            sut.Skills.SingleOrDefault(o =>
                                       o.Skill.Id.Equals(skill.Id) && o.Level.Id.Equals(newLevel.Id)
                                       ).Should().NotBeNull();
        }