MockItem.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
			public override string ToString ()
			{
				return _text;
			}

Usage Example

Beispiel #1
0
        public void ToString_Test()
        {
            // arrange
            MockItem testItem = new MockItem();

            testItem.Id    = 1;
            testItem.Title = "Test item";
            testItem.Type  = ItemType.Book;
            string expectedResult = "Id: " + "\r\n" +
                                    "1" + "\r\n" +
                                    "" + "\r\n" +
                                    "Title: " + "\r\n" +
                                    "Test item" + "\r\n" +
                                    "" + "\r\n" +
                                    "Type: " + "\r\n" +
                                    "Book";

            // act
            string actualResult = testItem.ToString();

            // assert
            Assert.AreEqual(expectedResult, actualResult);
        }