public string GetBookInfo_ByFull_ValidResult() { Book book1 = new Book("C# in Depth", "Jon Skeet", "Manning", "2019", "900", "40$"); BookFormatExtension bfe = new BookFormatExtension(); return(bfe.getInfo(book1, new OutFull())); }
public void BookFormatExtensionTest_BookAuthorTitlePagesPrice() { BookFormatExtension book = new BookFormatExtension("C# in Depth", "Jon Skeet", 2019, "Manning", 4, 900, 40); string str = book.ToString("AuthorTitlePagesPrice"); Assert.AreEqual("Book record: Jon Skeet, C# in Depth, 900, 40$", book.ToString("AuthorTitlePagesPrice")); }
public void BookFormatExtension_FormatBook_ReturnString() { IFormatProvider fp = new BookFormatExtension(); string formated = string.Format(fp, "{0:TP}", testBook); string expected = "Book: C# in Depth, 900"; Assert.AreEqual(formated, expected); }
public void BookExtention_ProviderGlobalInversion_ReturnString() { Book book = new Book("C# in Depth", "Jon Skeet", 2019, "Manning", 4, 900, 40); string expected = "C# in Depth, Jon Skeet"; BookFormatExtension bookExtention = new BookFormatExtension(); string actual = String.Format(bookExtention, "{0:GI}", book); Assert.AreEqual(expected, actual); }
public void BookExtention_StandartTitle_ReturnString() { Book book = new Book("C# in Depth", "Jon Skeet", 2019, "Manning", 4, 900, 40); string expected = "C# in Depth"; BookFormatExtension bookExtention = new BookFormatExtension(); string actual = String.Format(bookExtention, "{0:T}", book); Assert.AreEqual(expected, actual); }
public void StringFormatTestW() { BookLibrary.Book actual = new BookLibrary.Book() { Title = "C# in Depth", Author = "Jon Skeet", Year = 2019, PublishingHouse = "Manning", Edition = 4, Pages = 900, Price = 40 }; CultureInfo culture = new CultureInfo("en-US"); IFormatProvider fp = new BookFormatExtension(); string expectedResult = "Book record: C# in Depth"; Assert.AreEqual(expectedResult, string.Format(fp, "{0:W}", actual.Title)); }
public void CreateBookObject() { book = new Book("C# in Depth", "Jon Skeet", 2019, "Manning", 4, 900, 40); formatProvider = new BookFormatExtension(CultureInfo.GetCultureInfo("en-US")); }