public string ToString(StringFormEnum form) { string name = $"{this.Author}, {this.Name}"; if (form == StringFormEnum.ShortAndPublisher) { return(name + $", {this.Publisher}, {this.Year}"); } if (form == StringFormEnum.Full) { return($"{this.ISBN}, " + name + $", {this.Publisher}, {this.Year}, P.{this.Pages}"); } if (form == StringFormEnum.FullWithPrice) { return($"{this.ISBN}, " + name + $", {this.Publisher}, {this.Year}, P.{this.Pages}, {this.Price}$"); } return(name); }
public void StringBookRepresentationTest(StringFormEnum form, string expected) { Assert.AreEqual(expected, book.ToString(form)); }