public void TestThatStaticTextGetAllGetsStaticTextSystemViewCollection()
        {
            var client = _channelFactory.CreateChannel();

            try
            {
                IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client);
                Assert.That(translationInfoCollection, Is.Not.Null);
                Assert.That(translationInfoCollection, Is.Not.Empty);

                foreach (var translationInfoSystemView in translationInfoCollection)
                {
                    StaticTextCollectionGetQuery staticTextCollectionGetQuery = new StaticTextCollectionGetQuery
                    {
                        TranslationInfoIdentifier = translationInfoSystemView.TranslationInfoIdentifier
                    };
                    IList <StaticTextSystemView> staticTextSystemViewCollection = new List <StaticTextSystemView>(client.StaticTextGetAll(staticTextCollectionGetQuery));
                    Assert.That(staticTextSystemViewCollection, Is.Not.Null);
                    Assert.That(staticTextSystemViewCollection, Is.Not.Empty);
                    Assert.That(staticTextSystemViewCollection.Count, Is.EqualTo(Enum.GetValues(typeof(StaticTextType)).Cast <StaticTextType>().Count()));
                }
            }
            finally
            {
                ChannelTools.CloseChannel(client);
            }
        }
        /// <summary>
        /// Functionality which handles the query for getting a collection of static texts.
        /// </summary>
        /// <param name="query">Query for getting a collection of static texts.</param>
        /// <returns>Collection of static texts.</returns>
        public virtual IEnumerable <StaticTextSystemView> Query(StaticTextCollectionGetQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var translationInfo = _systemDataRepository.Get <ITranslationInfo>(query.TranslationInfoIdentifier);
            var staticTexts     = _systemDataRepository.StaticTextGetAll();

            return(_foodWasteObjectMapper.Map <IEnumerable <IStaticText>, IEnumerable <StaticTextSystemView> >(staticTexts, translationInfo.CultureInfo));
        }
コード例 #3
0
 public virtual IEnumerable <StaticTextSystemView> StaticTextGetAll(StaticTextCollectionGetQuery query)
 {
     if (query == null)
     {
         throw new ArgumentNullException(nameof(query));
     }
     try
     {
         return(_queryBus.Query <StaticTextCollectionGetQuery, IEnumerable <StaticTextSystemView> >(query));
     }
     catch (Exception ex)
     {
         throw _foodWasteFaultExceptionBuilder.Build(ex, SoapNamespaces.FoodWasteSystemDataServiceName, MethodBase.GetCurrentMethod());
     }
 }
コード例 #4
0
        public void TestThatStaticTextGetAllGetsStaticTextSystemViewCollection()
        {
            IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection();

            Assert.That(translationInfoCollection, Is.Not.Null);
            Assert.That(translationInfoCollection, Is.Not.Empty);

            foreach (var translationInfoSystemView in translationInfoCollection)
            {
                StaticTextCollectionGetQuery staticTextCollectionGetQuery = new StaticTextCollectionGetQuery
                {
                    TranslationInfoIdentifier = translationInfoSystemView.TranslationInfoIdentifier
                };
                IList <StaticTextSystemView> staticTextSystemViewCollection = new List <StaticTextSystemView>(_foodWasteSystemDataService.StaticTextGetAll(staticTextCollectionGetQuery));
                Assert.That(staticTextSystemViewCollection, Is.Not.Null);
                Assert.That(staticTextSystemViewCollection, Is.Not.Empty);
                Assert.That(staticTextSystemViewCollection.Count, Is.EqualTo(Enum.GetValues(typeof(StaticTextType)).Cast <StaticTextType>().Count()));
            }
        }