Skip to content

Commit

Permalink
string tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanstapel committed Oct 8, 2024
1 parent 20d363b commit e31655a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ZUGFeRD-Test/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class TestBase
{
protected string _makeSurePathIsCrossPlatformCompatible(string path)
{
if (string.IsNullOrEmpty(path))
if (string.IsNullOrWhiteSpace(path))
{
return path;
}
Expand Down
2 changes: 1 addition & 1 deletion ZUGFeRD-Test/ZUGFeRD20Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ public void TestWriteAndReadExtended()
//Line items
var loadedLineItem = loadedInvoice.TradeLineItems.FirstOrDefault(i => i.SellerAssignedID == "TB100A4");
Assert.IsNotNull(loadedLineItem);
Assert.IsTrue(!string.IsNullOrEmpty(loadedLineItem.AssociatedDocument.LineID));
Assert.IsTrue(!string.IsNullOrWhiteSpace(loadedLineItem.AssociatedDocument.LineID));
Assert.AreEqual("This is line item TB100A4", loadedLineItem.Description);

Assert.AreEqual("Trennblätter A4", loadedLineItem.Name);
Expand Down
2 changes: 1 addition & 1 deletion ZUGFeRD/InvoiceDescriptor22UBLWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream, ZUGFeRDFo
Writer.WriteEndElement();
}

if (!string.IsNullOrEmpty(tradeAllowanceCharge.Reason))
if (!string.IsNullOrWhiteSpace(tradeAllowanceCharge.Reason))
{
Writer.WriteStartElement("cbc:AllowanceChargeReason"); // BT-97 / BT-104
Writer.WriteValue(tradeAllowanceCharge.Reason);
Expand Down
10 changes: 5 additions & 5 deletions ZUGFeRD/InvoiceDescriptor22UblReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -673,27 +673,27 @@ private static Party _nodeAsParty(XmlNode baseNode, string xpath, XmlNamespaceMa
retval.ContactName = null;
}

if (string.IsNullOrEmpty(retval.AddressLine3))
if (string.IsNullOrWhiteSpace(retval.AddressLine3))
{
retval.AddressLine3 = String.Empty;
}

if (string.IsNullOrEmpty(retval.CountrySubdivisionName))
if (string.IsNullOrWhiteSpace(retval.CountrySubdivisionName))
{
retval.CountrySubdivisionName = String.Empty;
}

if (string.IsNullOrEmpty(retval.City))
if (string.IsNullOrWhiteSpace(retval.City))
{
retval.City = String.Empty;
}

if (string.IsNullOrEmpty(retval.Postcode))
if (string.IsNullOrWhiteSpace(retval.Postcode))
{
retval.Postcode = String.Empty;
}

if (string.IsNullOrEmpty(retval.Street))
if (string.IsNullOrWhiteSpace(retval.Street))
{
retval.Street = String.Empty;
}
Expand Down

0 comments on commit e31655a

Please sign in to comment.