public void IsChineseCharTest() { string s = string.Empty; bool expected = false; bool actual; actual = StringRegexExtension.IsChineseChar(s); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
public void GetScriptTest() { string s = string.Empty; string expected = string.Empty; string actual; actual = StringRegexExtension.GetScript(s); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
public void MatchTest() { string s = string.Empty; string pattern = string.Empty; string expected = string.Empty; string actual; actual = StringRegexExtension.Match(s, pattern); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> /// Writes the JSON representation of the object. /// </summary> /// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter" /> to write to.</param> /// <param name="value">The value.</param> /// <param name="serializer">The calling serializer.</param> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { var text = value.SafeToString(); if (!string.IsNullOrWhiteSpace(text)) { switch (NamingRule) { case EnumStringNamingRule.BySlash: text = StringRegexExtension.SplitByUpperCases(text, "-"); break; case EnumStringNamingRule.LowerCamelCase: text = Convert.ToString(Char.ToLowerInvariant(text[0])) + (text.Length > 1 ? text.Substring(1) : string.Empty); break; case EnumStringNamingRule.LowerCases: text = text.ToLowerInvariant(); break; } } writer.WriteValue(string.IsNullOrWhiteSpace(text) ? null : text); }
/// <summary> /// Splits the sentence by upper cases. /// </summary> /// <param name="anyString">Any string.</param> /// <returns></returns> public static string SplitSentenceByUpperCases(this string anyString) { return(StringRegexExtension.SplitByUpperCases(anyString, StringConstants.WhiteSpace)); }