예제 #1
0
        public async Task should_load_a_lot_of_stuff()
        {
            var config = new Configuration
            {
                Index     = "should_load_a_lot_of_stuff",
                BatchSize = 3
            };

            var client = CreateIndex(config);
            var data   = IndexTestBuilder.With().Create(10).Build();
            var sut    = new Indexer(client, config);
            var result = await sut.IndexMany(data.Select(x => x.ToSearchableItem()));

            result.Any(x => x.IsValid == false).ShouldBeFalse();

            CleanUpIndex(client, config);
        }
예제 #2
0
        public async Task should_return_error_if_same_id_exists()
        {
            var config = new Configuration
            {
                Index     = "should_return_error_if_same_id_exists",
                BatchSize = 3
            };

            var client = CreateIndex(config);
            var data   = IndexTestBuilder.With().CreateWithSameId(10).Build();
            var sut    = new Indexer(client, config);
            var result = await sut.IndexMany(data.Select(x => x.ToSearchableItem()));

            var indexResults = result as IList <IndexResult> ?? result.ToList();

            indexResults.Count(x => x.IsValid).ShouldBe(5);
            indexResults.Count(x => x.IsValid == false).ShouldBe(5);

            CleanUpIndex(client, config);
        }