public void CetEnumeratorFromQueueOfBooks_OneStepMoveNext_AndCurrentBook_IteratorIsNotNull_CurrentBookNameisFirst() { // Arrange var books = new List <BookIEquatable>() { new BookIEquatable() { Price = 1, Name = "First" }, new BookIEquatable() { Price = 2, Name = "Second" } }; var queueOfBooks = new Queue <BookIEquatable>(books); // Act var enumerator = queueOfBooks.GetEnumerator(); enumerator.MoveNext(); BookIEquatable currentBook = enumerator.Current; // Assert Assert.IsNotNull(enumerator); Assert.AreEqual(currentBook.Name, "First"); }
public void Peek_GetItemFromQueueOfBooks_ItemIsSecondBook() { // Arrange IEnumerable <BookIEquatable> books = new List <BookIEquatable>() { new BookIEquatable() { Price = 1, Name = "First" }, new BookIEquatable() { Price = 2, Name = "Second" } }; var queueOfBooks = new Queue <BookIEquatable>(books); // Act BookIEquatable book = queueOfBooks.Peek(); // Assert Assert.IsTrue(book.Name == "First"); }
public void Dequeue_OneItemFromQueueOfBooks_QueueHasOneItem() { // Arrange IEnumerable <BookIEquatable> books = new List <BookIEquatable>() { new BookIEquatable() { Price = 1, Name = "First" }, new BookIEquatable() { Price = 2, Name = "Second" } }; var queueOfBooks = new Queue <BookIEquatable>(books); // Act BookIEquatable book = queueOfBooks.Dequeue(); // Assert Assert.IsTrue(queueOfBooks.Count == 1); Assert.IsTrue(book.Name == "First"); }