public void LocalGoodFromStringFormatIsQuantityNameAtShelfPrice() { const string name = "Article ABC"; const int quantity = 2; const decimal shelfPrice = 10M; var builtGood = new Good(name, quantity, shelfPrice, Origin.Local); var importedGood = Good.FromString($"{quantity} {name} at {shelfPrice:F2}"); Assert.Equal(builtGood, importedGood); }
public void ImportedGoodFromStringFormatContainsTheWordImported() { const string name = "Article ABC DEF GHI"; const int quantity = 2; const decimal shelfPrice = 10M; var builtGood = new Good(name, quantity, shelfPrice, Origin.Imported); const string printedName1 = "imported Article ABC DEF GHI"; const string printedName2 = "Article ABC imported DEF GHI"; const string printedName3 = "Article ABC DEF imported GHI"; const string printedName4 = "Article ABC DEF GHI imported"; var importedGood1 = Good.FromString($"{quantity} {printedName1} at {shelfPrice:F2}"); var importedGood2 = Good.FromString($"{quantity} {printedName2} at {shelfPrice:F2}"); var importedGood3 = Good.FromString($"{quantity} {printedName3} at {shelfPrice:F2}"); var importedGood4 = Good.FromString($"{quantity} {printedName4} at {shelfPrice:F2}"); Assert.Equal(builtGood, importedGood1); Assert.Equal(builtGood, importedGood2); Assert.Equal(builtGood, importedGood3); Assert.Equal(builtGood, importedGood4); }