/// <summary> /// Functionality which handles a query for getting a collection of storage types. /// </summary> /// <param name="query">Query for getting a collection of storage types.</param> /// <returns>Collection of the storages types.</returns> public virtual IEnumerable <TView> Query(TQuery query) { if (query == null) { throw new ArgumentNullException(nameof(query)); } ITranslationInfo translationInfo = _systemDataRepository.Get <ITranslationInfo>(query.TranslationInfoIdentifier); IEnumerable <IStorageType> storageTypeCollection = _systemDataRepository.StorageTypeGetAll(); return(_objectMapper.Map <IEnumerable <IStorageType>, IEnumerable <TView> >(storageTypeCollection, translationInfo.CultureInfo)); }
public void TestThatStorageTypeGetAllReturnsStorageTypes() { IEnumerable <IStorageType> storageTypes = _systemDataRepository.StorageTypeGetAll(); // ReSharper disable PossibleMultipleEnumeration Assert.That(storageTypes, Is.Not.Null); Assert.That(storageTypes, Is.Not.Empty); Assert.That(storageTypes.Count(), Is.EqualTo(4)); Assert.That(storageTypes.SingleOrDefault(m => m.Identifier.HasValue && m.Identifier.Value == StorageType.IdentifierForRefrigerator), Is.Not.Null); Assert.That(storageTypes.SingleOrDefault(m => m.Identifier.HasValue && m.Identifier.Value == StorageType.IdentifierForFreezer), Is.Not.Null); Assert.That(storageTypes.SingleOrDefault(m => m.Identifier.HasValue && m.Identifier.Value == StorageType.IdentifierForKitchenCabinets), Is.Not.Null); Assert.That(storageTypes.SingleOrDefault(m => m.Identifier.HasValue && m.Identifier.Value == StorageType.IdentifierForShoppingBasket), Is.Not.Null); // ReSharper restore PossibleMultipleEnumeration }