Exemplo n.º 1
0
        public void SingleInterval()
        {
            var sut = new FileOpenTransformer(_context);

            sut.ProcessEvent(TestDocumentEvent(0, 0, "File1.cs", true));
            sut.ProcessEvent(TestDocumentEvent(1, 1, "File1.cs", false));

            var expected = ExpectedInterval(0, 1, "File1.cs");

            CollectionAssert.AreEquivalent(new[] { expected }, sut.SignalEndOfEventStream());
        }
Exemplo n.º 2
0
        public void CreatesIntervalIfCloseIsMissing()
        {
            var sut = new FileOpenTransformer(_context);

            sut.ProcessEvent(TestDocumentEvent(0, 1, "File1.cs", true, "a"));
            // missing close!

            var expected = new[]
            {
                ExpectedInterval(0, 1, "File1.cs", "a")
            };

            CollectionAssert.AreEquivalent(expected, sut.SignalEndOfEventStream());
        }
Exemplo n.º 3
0
        public void MultipleIntervalsWithOverlaps()
        {
            var sut = new FileOpenTransformer(_context);

            sut.ProcessEvent(TestDocumentEvent(0, 0, "File1.cs", true));
            sut.ProcessEvent(TestDocumentEvent(4, 4, "File1.cs", false));

            sut.ProcessEvent(TestDocumentEvent(2, 2, "File2.cs", true));
            sut.ProcessEvent(TestDocumentEvent(6, 6, "File2.cs", false));

            sut.ProcessEvent(TestDocumentEvent(8, 8, "File1.cs", true));
            sut.ProcessEvent(TestDocumentEvent(10, 10, "File1.cs", false));

            var expected = new[]
            {
                ExpectedInterval(0, 4, "File1.cs"),
                ExpectedInterval(2, 6, "File2.cs"),
                ExpectedInterval(8, 10, "File1.cs")
            };

            CollectionAssert.AreEquivalent(expected, sut.SignalEndOfEventStream());
        }