コード例 #1
0
        public void GetSelectionStart_Test()
        {
            // Arrange
            var text = "Hello";

            // Act
            Assert.AreEqual(text.Length, TextBoxBehavior.GetSelectionStart(text));
        }
コード例 #2
0
        public void Filter_Test()
        {
            // Arrange
            var text = ".H.e-l,lo.-,";

            // Act
            string actual = string.Empty;

            // Here simulate adding char at a time. Something like user is typing and filter removes wrong characters.
            for (int i = 0; i < text.Length; i++)
            {
                actual += text[i];
                actual  = TextBoxBehavior.Filter(actual, ".-,");
            }

            // Assert
            Assert.AreEqual("Hello", actual);
        }