public static void RunScenarios()
        {
            using (new SampleScenarioScope("Search"))
            {
                var view = Proxy.GetEntityView(
                    ShopsContainer,
                    string.Empty,
                    "Indexes",
                    string.Empty,
                    string.Empty);
                view.Should().NotBeNull();
                view.ChildViews.Should().NotBeNull();
                view.ChildViews.Should().NotBeEmpty();
                foreach (var entityView in view.ChildViews.OfType <EntityView>())
                {
                    view = new EntityView
                    {
                        Name        = "Index",
                        DisplayName = "Index",
                        EntityId    = entityView.EntityId,
                        Action      = "DeleteSearchIndex"
                    };
                    var result = Proxy.DoCommand(ShopsContainer.DoAction(view));
                    result.Messages.Should().NotContainErrors();
                }

                Minions.RunFullIndexMinions(Constants.AWMinionsEnvironmentName);
                Minions.RunFullIndexMinions(Constants.HabitatMinionsEnvironmentName);
            }
        }
Exemplo n.º 2
0
        public static async Task RunScenarios()
        {
            using (new SampleScenarioScope(nameof(GenericSearch)))
            {
                Minions.RunFullIndexMinions(Constants.AWMinionsEnvironmentName);

                var policySet = OpsContainer.PolicySets.ByKey("SearchPolicySet").GetValue();
                var scopeName = policySet.Policies.OfType <SearchScopePolicy>()
                                .First(p => p.Name.Contains("CatalogItemsScope")).Name;

                var searchQuery = new SearchQuery
                {
                    SearchNode = new MatchAllSearchNode()
                };

                var filterQuery = new FilterQuery
                {
                    FilterNode = new ContainsFilterNode
                    {
                        FieldName = new FieldNameFilterNode
                        {
                            Name = "name"
                        },
                        FieldValue = new FieldValueFilterNode
                        {
                            Value     = "Diamond",
                            ValueType = FilterNodeValueType.Text
                        }
                    }
                };

                var searchOptions = new SearchOptions
                {
                    Top = 3
                };

                var results = await ShopsContainer.GenericSearch(scopeName, searchQuery,
                                                                 filterQuery, searchOptions).ExecuteAsync().ConfigureAwait(false);

                results.Should().HaveCount(searchOptions.Top);
            }
        }