public void GetAvailableOnlyCommon() { var actual = cardService.GetAvailable(null); var expected = DtoConverters.GetCardsDtos(new List <Card> { cards.CardOne, cards.CardFive, cards.CardSeven, cards.CardCoffee }); Assert.AreEqual(expected, actual); }
public void GetAvailableWithPrivate() { var actual = cardService.GetAvailable(TestOwner); var expected = DtoConverters.GetCardsDtos(new List <Card> { cards.CardOne, cards.CardFive, cards.CardSeven, cards.CardCoffee, cards.CardEight, cards.CardTen }); Assert.AreEqual(expected, actual); }
/// <summary> /// Доступные карты. /// </summary> /// <param name="owner">Имя владельца.</param> /// <returns>Коллекцию ДТО карт.</returns> public IEnumerable <CardDto> GetAvailable(string owner) { List <Card> cards = this.repository.GetAll().Where(c => c.Owner == null).ToList(); if (owner != null) { cards.AddRange(this.repository.GetAll().Where(c => c.Owner == owner).ToList()); } return(DtoConverters.GetCardsDtos(cards)); }