Exemplo n.º 1
0
        public void UpdateTest1()
        {
            StringBuilder str = new StringBuilder("[TestString]");

            Assert.IsTrue(str.StartsWith("["));
            Assert.IsTrue(str.EndsWith("]"));

            Assert.AreEqual("TestString", str.UnBracketing(StringPair.SquareBracket).ToString());
        }
		public void StartsWith_StringNotAtStart()
		{
			StringBuilder builder = new StringBuilder();
			builder.Append("abcdefg");
			string startString = "bcd";

			bool startsWith = builder.StartsWith(startString);
			Assert.IsFalse(startsWith);

			startString = "BCD";
			startsWith = builder.StartsWith(startString, StringComparison.OrdinalIgnoreCase);
			Assert.IsFalse(startsWith);
		}
		public void StartsWith_ContainsNonAsciiCharacters()
		{
			StringBuilder builder = new StringBuilder();
			builder.Append("\u3041\u3042\u3043\u3044");
			string startString = "\u3041\u3042";
			bool startsWith = builder.StartsWith(startString);
			Assert.IsTrue(startsWith);
		}
		public void StartsWith_StringEmpty()
		{
			StringBuilder builder = new StringBuilder();
			builder.Append("abcdefg");
			string startString = string.Empty;
			bool startsWith = builder.StartsWith(startString);
		}
		public void StartsWith_StringNull()
		{
			StringBuilder builder = new StringBuilder();
			builder.Append("abcdefg");
			string startString = null;
			bool startsWith = builder.StartsWith(startString);
		}