public void TestStringTagToString() { StringTag tag = new StringTag(new RawTag(0x1, false, false, new byte[] { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x0 })); Assert.AreEqual("TLV[0x1]:\"test message\"", tag.ToString(), "Tag string representation should be correct"); tag = new StringTag(new RawTag(0x1, true, true, new byte[] { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x0 })); Assert.AreEqual("TLV[0x1,N,F]:\"test message\"", tag.ToString(), "Tag string representation should be correct"); }
public void TestStringTagCreateFromTag() { StringTag tag = new StringTag(new RawTag(0x1, false, false, new byte[] { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x0 })); Assert.AreEqual(0x1, tag.Type, "Tag type should be correct"); Assert.IsFalse(tag.NonCritical, "Tag non critical flag should be correct"); Assert.IsFalse(tag.Forward, "Tag forward flag should be correct"); Assert.AreEqual("test message", tag.Value, "Tag value should be decoded correctly"); Assert.AreEqual("TLV[0x1]:\"test message\"", tag.ToString(), "Tag string representation should be correct"); }
/// <summary> /// Validates if is safe to continue with operation, if not shows a message box with the error /// </summary> /// <param name="text"></param> /// <returns></returns> public bool ValidateFormFromString(StringTag text) => ValidateFormFromString(text?.ToString());
/// <summary> /// Validates if is safe to continue with operation, if not shows a message box with the error /// </summary> /// <param name="text"></param> /// <returns></returns> public async Task <bool> ValidateFormFromString(StringTag text) => await ValidateFormFromString(text?.ToString());