public void Verify_Roundtrip() { var e = new Base64Encoding(); Assert.AreEqual(EncodedMessage, e.GetString(e.GetBytes(EncodedMessage))); }
public string GetString() { ValueHandleType type = this.type; if (type == ValueHandleType.UTF8) { return(this.GetCharsText()); } switch (type) { case ValueHandleType.Empty: return(string.Empty); case ValueHandleType.True: return("true"); case ValueHandleType.False: return("false"); case ValueHandleType.Zero: return("0"); case ValueHandleType.One: return("1"); case ValueHandleType.Int8: case ValueHandleType.Int16: case ValueHandleType.Int32: return(XmlConverter.ToString(this.ToInt())); case ValueHandleType.Int64: return(XmlConverter.ToString(this.GetInt64())); case ValueHandleType.UInt64: return(XmlConverter.ToString(this.GetUInt64())); case ValueHandleType.Single: return(XmlConverter.ToString(this.GetSingle())); case ValueHandleType.Double: return(XmlConverter.ToString(this.GetDouble())); case ValueHandleType.Decimal: return(XmlConverter.ToString(this.GetDecimal())); case ValueHandleType.DateTime: return(XmlConverter.ToString(this.ToDateTime())); case ValueHandleType.TimeSpan: return(XmlConverter.ToString(this.ToTimeSpan())); case ValueHandleType.Guid: return(XmlConverter.ToString(this.ToGuid())); case ValueHandleType.UniqueId: return(XmlConverter.ToString(this.ToUniqueId())); case ValueHandleType.UTF8: return(this.GetCharsText()); case ValueHandleType.EscapedUTF8: return(this.GetEscapedCharsText()); case ValueHandleType.Base64: return(Base64Encoding.GetString(this.ToByteArray())); case ValueHandleType.Dictionary: return(this.GetDictionaryString().Value); case ValueHandleType.List: return(XmlConverter.ToString(this.ToList())); case ValueHandleType.Char: return(this.GetCharText()); case ValueHandleType.Unicode: return(this.GetUnicodeCharsText()); case ValueHandleType.QName: return(this.GetQNameDictionaryText()); case ValueHandleType.ConstString: return(constStrings[this.offset]); } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException()); }