Ejemplo n.º 1
0
        public void PageDoesNotPlayCompletionSound_WhenCompletedCriterionIsNotActiveInstruction()
        {
            MockCriterion secondCriterion = null;

            try
            {
                secondCriterion = ScriptableObject.CreateInstance <MockCriterion>();
                var secondInstruction = new TutorialParagraph
                {
                    m_Type     = ParagraphType.Instruction,
                    m_Criteria = new TypedCriterionCollection(
                        new[] { new TypedCriterion(new SerializedType(typeof(MockCriterion)), secondCriterion) }
                        )
                };
                m_Page.m_Paragraphs =
                    new TutorialParagraphCollection(new[] { m_Page.paragraphs.First(), secondInstruction });

                var playedSound = false;
                m_Page.playedCompletionSound += page => playedSound = true;

                secondCriterion.Complete(true);
                Assert.IsFalse(playedSound, "Played sound for second step when first step was not yet completed.");
            }
            finally
            {
                if (secondCriterion != null)
                {
                    UnityObject.DestroyImmediate(secondCriterion);
                }
            }
        }
Ejemplo n.º 2
0
 public void PageMarkedIncomplete_WhenACriterionIsInvalidated()
 {
     Assert.IsFalse(m_Page.allCriteriaAreSatisfied);
     m_Criterion.Complete(true);
     Assert.IsTrue(m_Page.allCriteriaAreSatisfied);
     m_Criterion.Complete(false);
     Assert.IsFalse(m_Page.allCriteriaAreSatisfied);
 }