public void ConcatHandlerReturnsExpectedResult()
        {
            var handler1 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler2 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler3 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var sut      = new ElasticsearchProjection(new[]
            {
                handler1,
                handler2
            });

            var result = sut.Concat(handler3);

            Assert.That(result.Handlers, Is.EquivalentTo(new[] { handler1, handler2, handler3 }));
        }
        public void ConcatHandlerReturnsExpectedResult()
        {
            var handler1 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler2 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler3 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var sut = new ElasticsearchProjection(new[]
            {
                handler1,
                handler2
            });

            var result = sut.Concat(handler3);

            Assert.That(result.Handlers, Is.EquivalentTo(new[] { handler1, handler2, handler3 }));
        }
        public void ExplicitConversionToElasticsearchProjectionHandlerArray()
        {
            var handler1 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler2 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));

            var handlers = new[]
            {
                handler1,
                handler2
            };

            var sut = new ElasticsearchProjection(handlers);

            var result = (ElasticsearchProjectionHandler[])sut;

            Assert.That(result, Is.EquivalentTo(handlers));
        }
        public void HandlersArePreservedAsProperty()
        {
            var handler1 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler2 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));

            var handlers = new[]
            {
                handler1,
                handler2
            };

            var sut = new ElasticsearchProjection(handlers);

            var result = sut.Handlers;

            Assert.That(result, Is.EquivalentTo(handlers));
        }
        public void DecoratedProjectionHandlersAreCopiedOnConstruction()
        {
            var handler1 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler2 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var projection = new ElasticsearchProjection(new[]
            {
                handler1,
                handler2
            });
            var sut = new ElasticsearchProjectionBuilder(projection);

            var result = sut.Build();

            Assert.That(result.Handlers, Is.EquivalentTo(new[]
            {
                handler1, handler2
            }));
        }
Beispiel #6
0
        public void DecoratedProjectionHandlersAreCopiedOnConstruction()
        {
            var handler1   = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler2   = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var projection = new ElasticsearchProjection(new[]
            {
                handler1,
                handler2
            });
            var sut = new ElasticsearchProjectionBuilder(projection);

            var result = sut.Build();

            Assert.That(result.Handlers, Is.EquivalentTo(new[]
            {
                handler1, handler2
            }));
        }
        public void ImplicitConversionToElasticsearchProjectionHandlerArray()
        {
            var handler1 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler2 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));

            var handlers = new[]
            {
                handler1,
                handler2
            };

            var sut = new ElasticsearchProjection(handlers);

            ElasticsearchProjectionHandler[] result = sut;

            Assert.That(result, Is.EquivalentTo(handlers));
        }
        public void HandlersArePreservedAsProperty()
        {
            var handler1 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));
            var handler2 = new ElasticsearchProjectionHandler(typeof(object), (client, message, token) => Task.FromResult(false));

            var handlers = new[]
            {
                handler1,
                handler2
            };

            var sut = new ElasticsearchProjection(handlers);

            var result = sut.Handlers;

            Assert.That(result, Is.EquivalentTo(handlers));
        }