public void RetrievedItem_WithValidItem_ReturnsRetrievedItem()
        {
            var result = new RetrievedItem <Item>(_item);

            Assert.That(result.Item, Is.EqualTo(_item));
            Assert.That(result.WasFound, Is.True);
        }
        public void GetItem_NonEmptyRetrievedItem_ReturnsItem()
        {
            var nonEmptyRetrievedItem = new RetrievedItem <Item>(_item);

            var result = nonEmptyRetrievedItem.Item;

            Assert.That(_item, Is.EqualTo(result));
        }
Exemple #3
0
        public bool Equals(RetrievedItem <Item> first, RetrievedItem <Item> second)
        {
            if (first == null && second == null)
            {
                return(true);
            }

            if (first == null || second == null)
            {
                return(false);
            }

            return(ItemComparer.LazyComparer.Equals(first.Item, second.Item) && first.WasFound == second.WasFound);
        }
Exemple #4
0
 public int GetHashCode(RetrievedItem <Item> retrievedItem) =>
 ItemComparer.LazyComparer.GetHashCode(retrievedItem.Item) + retrievedItem.WasFound.GetHashCode();
 public void RetrievedItem_WithNullItem_ThrowsArgumentNullException() =>
 Assert.Throws <ArgumentNullException>(() =>
 {
     var _ = new RetrievedItem <Item>(item: null);
 });