Exemplo n.º 1
0
        public void CanEvaluate()
        {
            var interpreter = TestBootstrapper.Setup(
                "Discriminator, Url, What, Expect\n" +
                "GoToUrl,       {\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n" +
                "GoToUrl,       {\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n");

            Should.Be <SuccessAnswer>(interpreter.Please("skip"));

            Assert.IsFalse((interpreter.Plan.First() as Keyword).IsHydrated);
            Assert.IsFalse((interpreter.Plan.Last() as Keyword).IsHydrated);

            Should.Be <SuccessAnswer>(interpreter.Please("eval"));

            Assert.IsFalse((interpreter.Plan.First() as Keyword).IsHydrated);
            Assert.IsTrue((interpreter.Plan.Last() as Keyword).IsHydrated);


            TestBootstrapper.ModifyScenario(
                "Discriminator, Url, What, Expect\n" +
                "GoToUrl,{\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n" +
                "GoToUrl,{\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n" +
                "GoToUrl,{\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n");

            Should.Be <SuccessAnswer>(interpreter.Please("reload"));

            Assert.AreEqual(3, interpreter.Plan.Count());
            Assert.IsFalse(((Keyword)interpreter.Plan.First()).IsHydrated);
            Assert.IsFalse(((Keyword)interpreter.Plan.Last()).IsHydrated);
            Assert.AreEqual(1, interpreter.Iterator.Index);

            Should.Be <SuccessAnswer>(interpreter.Please("eval"));

            Assert.IsFalse(((Keyword)interpreter.Plan.First()).IsHydrated);
            Assert.IsTrue(((Keyword)interpreter.Plan.Skip(1).First()).IsHydrated);
            Assert.IsFalse(((Keyword)interpreter.Plan.Last()).IsHydrated);
        }