Ejemplo n.º 1
0
        public void Ctor_OtherCodePointFilterAsConcreteType_Clones()
        {
            // Arrange
            var originalFilter = new CodePointFilter();
            originalFilter.AllowCharacter('x');

            // Act
            var newFilter = new CodePointFilter(originalFilter);
            newFilter.AllowCharacter('y');

            // Assert
            Assert.True(originalFilter.IsCharacterAllowed('x'));
            Assert.False(originalFilter.IsCharacterAllowed('y'));
            Assert.True(newFilter.IsCharacterAllowed('x'));
            Assert.True(newFilter.IsCharacterAllowed('y'));
        }
Ejemplo n.º 2
0
        public void AllowChar()
        {
            // Arrange
            var filter = new CodePointFilter();

            // Act
            var retVal = filter.AllowCharacter('\u0100');

            // Assert
            Assert.Same(filter, retVal); // returns 'this' instance
            Assert.True(filter.IsCharacterAllowed('\u0100'));
            Assert.False(filter.IsCharacterAllowed('\u0101'));
        }
Ejemplo n.º 3
0
        public void Clear()
        {
            // Arrange
            var filter = new CodePointFilter();
            for (int i = 1; i <= Char.MaxValue; i++)
            {
                filter.AllowCharacter((char)i);
            }

            // Act
            var retVal = filter.Clear();

            // Assert
            Assert.Same(filter, retVal); // returns 'this' instance
            for (int i = 0; i <= Char.MaxValue; i++)
            {
                Assert.False(filter.IsCharacterAllowed((char)i));
            }
        }
Ejemplo n.º 4
0
        public void AllowChar()
        {
            // Arrange
            var filter = new CodePointFilter();
            filter.AllowCharacter('\u0100');

            // Assert
            Assert.True(filter.IsCharacterAllowed('\u0100'));
            Assert.False(filter.IsCharacterAllowed('\u0101'));
        }
Ejemplo n.º 5
0
        public void Clear()
        {
            // Arrange
            var filter = new CodePointFilter();
            for (int i = 1; i <= Char.MaxValue; i++)
            {
                filter.AllowCharacter((char)i);
            }

            // Act
            filter.Clear();

            // Assert
            for (int i = 0; i <= Char.MaxValue; i++)
            {
                Assert.False(filter.IsCharacterAllowed((char)i));
            }
        }