示例#1
0
        public async Task CorrectlyFilterEntitiesWithRuntimeMetadataAsync()
        {
            var serviceLocator = ServiceLocator.Default;

            var typeFactory = serviceLocator.ResolveType <ITypeFactory>();

            var filterScheme = await FilterSchemeInitializationHelper.GetTestFilterSchemeAsync();

            var initialCollection = TestDataProvider.GetInitialCollection();
            var resultList        = new List <TestFilterRuntimeModel>();

            var filterService = typeFactory.CreateInstance <FilterService>();
            await filterService.FilterCollectionAsync(filterScheme, initialCollection, resultList);

            Assert.AreEqual(1, resultList.Count);
            Assert.AreEqual("one", resultList[0].Attributes[AttributeTypeNames.StringAttribute].Value);
        }
        public void CorrectlyFilterEntitiesWithRuntimeMetadata()
        {
            var serviceLocator = ServiceLocator.Default;

            var typeFactory = serviceLocator.ResolveType <ITypeFactory>();

            var filterScheme      = FilterSchemeInitializationHelper.GetTestFilterScheme();
            var initialCollection = TestDataProvider.GetInitialCollection();
            var resultList        = new List <TestFilterRuntimeModel>();

            var filterService = typeFactory.CreateInstanceWithParametersAndAutoCompletion <FilterService>();

            filterService.FilterCollection(filterScheme, initialCollection, resultList);

            Assert.AreEqual(1, resultList.Count);
            Assert.AreEqual(resultList[0].Attributes[AttributeTypeNames.StringAttribute].Value, "one");
        }