Example #1
0
        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);
        }
Example #2
0
 public void StringBookRepresentationTest(StringFormEnum form, string expected)
 {
     Assert.AreEqual(expected, book.ToString(form));
 }