Ejemplo n.º 1
0
        public void IndexDescriptorWithoutTransaction()
        {
            _transactionalElasticClient.Index(new TestObject()
            {
                Id = "id"
            });

            ElasticClient.Get <TestObject>("id").Source.Should().NotBeNull();
        }
        public void UpdateDescriptorWithoutTransaction()
        {
            _transactionalElasticClient.Index(new TestObject()
            {
                Id = "id", Value = "value1"
            });

            _transactionalElasticClient.Update <TestObject>("id", descriptor => descriptor.Doc(new TestObject()
            {
                Value = "value2"
            }));

            ElasticClient.Refresh(CurrentTestIndexName());
            ElasticClient.Get <TestObject>("id").Source.Value.Should().Be("value2");
        }
Ejemplo n.º 3
0
        public void DeleteDescriptorWithTransaction_MultipleObjects_NotCommitted_NothingDeleted()
        {
            _transactionalElasticClient.Index(new TestObject()
            {
                Id = "id1"
            });
            _transactionalElasticClient.Index(new TestObject()
            {
                Id = "id2"
            });

            using (TransactionScope txSc = new TransactionScope())
            {
                _transactionalElasticClient.Delete <TestObject>("id1");
                _transactionalElasticClient.Delete <TestObject>("id2");
            }

            ElasticClient.Get <TestObject>("id1").Source.Should().NotBeNull();
            ElasticClient.Get <TestObject>("id2").Source.Should().NotBeNull();
        }