Exemplo n.º 1
0
        public static void IgnoreCurrent_HasNoMatch_NotInsideTag()
        {
            // Arrange
            var state = new ShrinkState()
            {
                InsideTag   = false,
                IgnoreCount = 10,
                Current     = NotMatch
            };

            // Act
            var result = ShrinkHelper.IgnoreCurrent(Match, state);

            // Assert
            Assert.False(result);
            Assert.False(state.InsideTag);
            Assert.Equal(10, state.IgnoreCount);
            Assert.Equal(NotMatch, state.Current);
        }
Exemplo n.º 2
0
        public static void IgnoreCurrent_HasMatch()
        {
            // Arrange
            var state = new ShrinkState()
            {
                InsideTag   = g_random.NextBoolean(),
                IgnoreCount = g_random.NextInt(0, 4),
                Current     = Match[0]
            };

            // Act
            var result = ShrinkHelper.IgnoreCurrent(Match, state);

            // Assert
            Assert.False(result);
            Assert.True(state.InsideTag);
            Assert.Equal(0, state.IgnoreCount);
            Assert.Equal(Match[0], state.Current);
        }
Exemplo n.º 3
0
        public static void IgnoreCurrent_InsideTag_HasNoIgnoreMatch()
        {
            // Arrange
            var state = new ShrinkState()
            {
                InsideTag   = true,
                IgnoreCount = 4,
                Current     = NotMatch
            };

            // Act
            var result = ShrinkHelper.IgnoreCurrent(Match, state);

            // Assert
            Assert.False(result);
            Assert.False(state.InsideTag);
            Assert.Equal(4, state.IgnoreCount);
            Assert.Equal(NotMatch, state.Current);
        }
Exemplo n.º 4
0
        public static void IgnoreCurrent_InsideTag_HasIgnoreMatch_AtLeast_One()
        {
            // Arrange
            var state = new ShrinkState()
            {
                InsideTag   = true,
                IgnoreCount = 4,
                Current     = IgnoreMatch
            };

            // Act
            var result = ShrinkHelper.IgnoreCurrent(Match, state);

            // Assert
            Assert.True(result);
            Assert.True(state.InsideTag);
            Assert.Equal(5, state.IgnoreCount);
            Assert.Equal(IgnoreMatch, state.Current);
        }
Exemplo n.º 5
0
        public static void IgnoreCurrent_InsideTag_HasIgnoreMatch_FirstTime()
        {
            // Arrange
            ShrinkHelper.LeaveAtLeast = 1;
            var state = new ShrinkState()
            {
                InsideTag   = true,
                IgnoreCount = 0,
                Current     = IgnoreMatch
            };

            // Act
            var result = ShrinkHelper.IgnoreCurrent(Match, state);

            // Assert
            Assert.False(result);
            Assert.True(state.InsideTag);
            Assert.Equal(1, state.IgnoreCount);
            Assert.Equal(IgnoreMatch, state.Current);
        }