Ejemplo n.º 1
0
        public void TestThatTranslationsForDomainObjectGetGetsTranslationsForIdentifiableDomainObject()
        {
            var translationInfos = _systemDataRepository.TranslationInfoGetAll().ToArray();
            var tranlationOf     = new Translation(Guid.NewGuid(), translationInfos.FirstOrDefault(), "Test")
            {
                Identifier = Guid.NewGuid()
            };
            // ReSharper disable PossibleInvalidOperationException
            var translation = _systemDataRepository.Insert(new Translation(tranlationOf.Identifier.Value, translationInfos.FirstOrDefault(), "Test"));

            // ReSharper restore PossibleInvalidOperationException
            try
            {
                // ReSharper disable PossibleInvalidOperationException
                var result = _systemDataRepository.TranslationsForDomainObjectGet(tranlationOf);
                // ReSharper restore PossibleInvalidOperationException
                // ReSharper disable PossibleMultipleEnumeration
                Assert.That(result, Is.Not.Null);
                Assert.That(result, Is.Not.Empty);
                // ReSharper restore PossibleMultipleEnumeration
            }
            finally
            {
                _systemDataRepository.Delete(translation);
            }
        }
        /// <summary>
        /// Functionality which handles the query for getting a collection of translation informations.
        /// </summary>
        /// <param name="query">Query for getting a collection of translation informations.</param>
        /// <returns>Collection of translation informations.</returns>
        public virtual IEnumerable <TranslationInfoSystemView> Query(TranslationInfoCollectionGetQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }
            var translationInfoCollection = _systemDataRepository.TranslationInfoGetAll();

            return(_foodWasteObjectMapper.Map <IEnumerable <ITranslationInfo>, IEnumerable <TranslationInfoSystemView> >(translationInfoCollection.Where(m => m.Identifier.HasValue).OrderBy(m => m.CultureName)));
        }