Ejemplo n.º 1
0
        public void ShouldAllowEmptyTimeline()
        {
            Timeline t = TimelineLoader.LoadFromText("test", "");

            Assert.AreEqual(0, t.Items.Count());
            Assert.IsFalse(t.VisibleItemsAt(0, 10).Any());
        }
        public void EOLAtEOFShouldBeOptional()
        {
            Timeline timeline = TimelineLoader.LoadFromText("test", "1 テスト");
            var      items    = timeline.Items.ToList();

            Assert.AreEqual(1, items.Count);
            Assert.AreEqual(1.0, items.First().TimeFromStart);
            Assert.AreEqual("テスト", items.First().Name);
        }
        public void TestTimelineStatementBasic()
        {
            Timeline timeline = TimelineLoader.LoadFromText("test", "1 テスト\n");
            var      items    = timeline.Items.ToList();

            Assert.AreEqual(1, items.Count);
            Assert.AreEqual(1.0, items.First().TimeFromStart);
            Assert.AreEqual("テスト", items.First().Name);
        }
        public void TestTimelineStatementRegression()
        {
            Timeline timeline = TimelineLoader.LoadFromText("test", "0 \"asdf\" sync /aaa/ window 999\n1 bbb\n");
            var      items    = timeline.Items.ToList();

            Assert.AreEqual(2, items.Count);
            Assert.AreEqual(0.0, items.First().TimeFromStart);
            Assert.AreEqual("asdf", items.First().Name);
        }
Ejemplo n.º 5
0
        public void ActivitiesWithSameTimeToStartShouldBeAccepted()
        {
            string txt = "";

            for (int i = 0; i < 10; ++i)
            {
                txt += String.Format("1 {0}\n", i);
            }
            Timeline t = TimelineLoader.LoadFromText("test", txt);
        }
Ejemplo n.º 6
0
        public void AnchorWindowShouldBeRespected()
        {
            Timeline       t = TimelineLoader.LoadFromText("test", "100 テスト sync /a/ window 20,30\n");
            TimelineAnchor a = t.Anchors.First();

            Assert.AreSame(a, t.FindAnchorMatchingLogline(100, "a"), "With in window");
            Assert.AreSame(a, t.FindAnchorMatchingLogline(81, "a"), "With in before window");
            Assert.AreSame(a, t.FindAnchorMatchingLogline(129, "a"), "With in after window");

            Assert.IsNull(t.FindAnchorMatchingLogline(79, "a"), "Out of before window");
            Assert.IsNull(t.FindAnchorMatchingLogline(131, "a"), "Out of after window");
        }
        public void TestTimelineStatementWithBeforeAndAfterWindow()
        {
            Timeline timeline = TimelineLoader.LoadFromText("test", "1 テスト sync /「テスト」の構え/ window 10, 20\n");
            var      items    = timeline.Items.ToList();

            Assert.AreEqual(1, items.Count);
            Assert.AreEqual(1.0, items.First().TimeFromStart);
            Assert.AreEqual("テスト", items.First().Name);

            var anchors = timeline.Anchors.ToList();

            Assert.AreEqual(1, anchors.Count);
            Assert.AreEqual("「テスト」の構え", anchors.First().Regex.ToString());
            Assert.AreEqual(10, anchors.First().WindowBefore);
            Assert.AreEqual(20, anchors.First().WindowAfter);
        }
Ejemplo n.º 8
0
        public void VisibleItemsAtShouldReturnActivitiesWithSameStartTime()
        {
            string txt = "";

            for (int i = 0; i < 10; ++i)
            {
                txt += String.Format("{0} {0}a\n", i);
                txt += String.Format("{0} {0}b\n", i);
                txt += String.Format("{0} {0}c\n", i);
            }
            Timeline t = TimelineLoader.LoadFromText("test", txt);

            {
                var visibleItemsStr = t.VisibleItemsAt(5.1, 10).Select(a => a.Name).Aggregate((a, n) => a + " " + n);
                Assert.AreEqual("6a 6b 6c 7a 7b 7c 8a 8b 8c 9b", visibleItemsStr);
            }
            {
                var visibleItemsStr = t.VisibleItemsAt(5, 10).Select(a => a.Name).Aggregate((a, n) => a + " " + n);
                Assert.AreEqual("6a 6b 6c 7a 7b 7c 8a 8b 8c 9b", visibleItemsStr);
            }
        }
Ejemplo n.º 9
0
        public void VisibleItemsAtShouldReturnUnfinishedActivities()
        {
            string txt = "";

            for (int i = 0; i < 10; ++i)
            {
                txt += String.Format("{0} {0}\n", i);
            }
            Timeline t = TimelineLoader.LoadFromText("test", txt);

            {
                var visibleItems = t.VisibleItemsAt(5.1, 10).ToList();
                Assert.AreEqual(4, visibleItems.Count);
            }
            {
                var visibleItems = t.VisibleItemsAt(5, 10).ToList();
                Assert.AreEqual(4, visibleItems.Count);
            }
            {
                var visibleItems = t.VisibleItemsAt(4.9, 10).ToList();
                Assert.AreEqual(5, visibleItems.Count);
            }
        }