Ejemplo n.º 1
0
        public void ChildSkillCanNotBeUnlockedLockedWhenItHasLockedParentSkillTest()
        {
            var graph  = new SkillGraph <int>();
            var child  = graph.Add(2, "child skill");
            var parent = graph.Add(10, "parent skill", new[] { child });

            Assert.IsTrue(parent.IsLocked);
            Assert.IsFalse(child.CanBeUnlockedLocked);
            Assert.IsFalse(child.TryUnlock());
        }
Ejemplo n.º 2
0
        public void ShouldAddChildElementsWhenSkillHasChildrenTest()
        {
            var graph  = new SkillGraph <int>();
            var child  = graph.Add(2, "child skill");
            var parent = graph.Add(10, "parent skill", new[] { child });

            Assert.IsNotNull(parent.Childern);
            Assert.AreEqual(1, parent.Childern.Length);
            Assert.IsNotNull(child.Parents);
            Assert.AreEqual(1, child.Parents.Length);
        }
Ejemplo n.º 3
0
        public void ShouldAddNewSkillTest()
        {
            var graph = new SkillGraph <int>();
            var name  = "skill";
            var key   = 1;

            graph.Add(key, name);

            Assert.IsNotNull(graph[key]);
            Assert.AreEqual(name, graph[key].Name);
        }
Ejemplo n.º 4
0
        public void ChildSkillCanNotBeUnlockedLockedWhenOneOfTheParentsIsLockedTest()
        {
            var graph   = new SkillGraph <int>();
            var child   = graph.Add(2, "child skill");
            var parent1 = graph.Add(10, "parent 1 skill", new[] { child });
            var parent2 = graph.Add(20, "parent 2 skill", new[] { child });

            parent1.TryUnlock();

            Assert.IsFalse(parent1.IsLocked);
            Assert.IsTrue(parent2.IsLocked);
            Assert.IsFalse(child.CanBeUnlockedLocked);
            Assert.IsFalse(child.TryUnlock());
        }
Ejemplo n.º 5
0
 protected Character()
 {
     Skills = new SkillGraph <TSkill>();
     CreateSkillSet();
 }