コード例 #1
0
        public async Task should_returnfalse_when_indexing_first_same_version()
        {
            var config = new Configuration
            {
                Index     = "should_returnfalse_when_indexing_first_same_version",
                BatchSize = 1
            };
            var client = CreateIndex(config);

            var sut  = new Indexer(client, config);
            var item = new IndexTest
            {
                Id      = 1,
                Version = 2,
                Name    = "Name",
                Active  = true
            }.ToSearchableItem();
            var indexResult1 = await sut.Index(item);

            indexResult1.ShouldBe(true);
            item = new IndexTest
            {
                Id      = 1,
                Version = 1,
                Name    = "Name2",
                Active  = false
            }.ToSearchableItem();
            var indexResult2 = await sut.Index(item);

            indexResult2.ShouldBeFalse();

            CleanUpIndex(client, config);
        }
コード例 #2
0
        public async Task should_be_valid_when_indexing_first_version()
        {
            var config = new Configuration
            {
                Index     = "should_be_valid_when_indexing_first_version",
                BatchSize = 1
            };
            var client = CreateIndex(config);

            var sut  = new Indexer(client, config);
            var item = new IndexTest
            {
                Id      = 1,
                Version = 1,
                Name    = "Name",
                Active  = true
            }.ToSearchableItem();
            var indexResult = await sut.Index(item);

            indexResult.ShouldBeTrue();

            CleanUpIndex(client, config);
        }