public void TextWithEncoding_CompareTo_2() { TextWithEncoding first = "Hello"; TextWithEncoding second = null; Assert.IsTrue(first.CompareTo(second) > 0); }
public void TextWithEncoding_ImplicitOperator_1() { TextWithEncoding text = "Hello"; byte[] bytes = text.ToBytes(); Assert.AreEqual(5, bytes.Length); }
public void TextWithEncoding_CompareTo_1() { TextWithEncoding first = "Hello"; TextWithEncoding second = "World"; Assert.IsTrue(first.CompareTo(second) < 0); }
public void TextWithEncoding_Construction_3() { TextWithEncoding text = new TextWithEncoding("Hello", true); byte[] bytes = text.ToBytes(); Assert.AreEqual(5, bytes.Length); }
public void TextWithEncoding_Construction_4() { TextWithEncoding text = new TextWithEncoding("Привет", Encoding.GetEncoding(1251)); byte[] bytes = text.ToBytes(); Assert.AreEqual(6, bytes.Length); }
public void TextWithEncoding_Construction_2() { TextWithEncoding text = new TextWithEncoding("Привет"); byte[] bytes = text.ToBytes(); Assert.AreEqual(12, bytes.Length); }
public void TextWithEncoding_ToString_1() { TextWithEncoding text = new TextWithEncoding(); Assert.AreEqual(string.Empty, text.ToString()); text = "Hello"; Assert.AreEqual("Hello", text.ToString()); }
public void TextWithEncoding_GetHashCode_1() { TextWithEncoding text = new TextWithEncoding(); Assert.AreEqual(0, text.GetHashCode()); text = "Hello"; Assert.AreEqual("Hello".GetHashCode(), text.GetHashCode()); }
public void TextWithEncoding_Equals_2() { TextWithEncoding first = new TextWithEncoding("Hello", true); TextWithEncoding second = new TextWithEncoding("World", false); Assert.IsFalse(first.Equals((object)second)); Assert.IsTrue(first.Equals((object)first)); Assert.IsFalse(first.Equals((object)null)); }
public void TextWithEncoding_Comparison_2() { TextWithEncoding first = new TextWithEncoding("Hello", true); TextWithEncoding second = null; Assert.AreEqual ( false, first == second ); }
public void TextWithEncoding_Comparison_4() { TextWithEncoding first = new TextWithEncoding("Hello", true); TextWithEncoding second = new TextWithEncoding("World", false); Assert.AreEqual ( true, first != second ); }
/// <summary> /// Записываем строку в произвольной кодировке. /// </summary> public static Stream EncodeTextWithEncoding ( [NotNull] this Stream stream, [CanBeNull] TextWithEncoding text ) { if (!ReferenceEquals(text, null)) { byte[] bytes = text.ToBytes(); stream.Write(bytes, 0, bytes.Length); } return(stream); }
/// <summary> /// Create client query. /// </summary> public override ClientQuery CreateQuery() { ClientQuery result = base.CreateQuery(); result.CommandCode = CommandCode.ReadDocument; foreach (FileSpecification fileName in Files) { TextWithEncoding text = new TextWithEncoding ( fileName.ToString(), IrbisEncoding.Ansi ); result.Arguments.Add(text); } return(result); }