예제 #1
0
        public void ConcatHandlerReturnsExpectedResult()
        {
            var handler1 = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));
            var handler2 = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));
            var handler3 = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));
            var sut      = new RavenProjection(new[]
            {
                handler1,
                handler2
            });

            var result = sut.Concat(handler3);

            Assert.That(result.Handlers, Is.EquivalentTo(new[] { handler1, handler2, handler3 }));
        }
예제 #2
0
        public void ExplicitConversionToRavenProjectionHandlerArray()
        {
            var handler1 = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));
            var handler2 = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));

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

            var sut = new RavenProjection(handlers);

            var result = (RavenProjectionHandler[])sut;

            Assert.That(result, Is.EquivalentTo(handlers));
        }
예제 #3
0
        public void HandlersArePreservedAsProperty()
        {
            var handler1 = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));
            var handler2 = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));

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

            var sut = new RavenProjection(handlers);

            var result = sut.Handlers;

            Assert.That(result, Is.EquivalentTo(handlers));
        }
예제 #4
0
        public void ToBuilderReturnsExpectedResult()
        {
            var handler1 = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));
            var handler2 = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));
            var sut      = new RavenProjection(new[]
            {
                handler1,
                handler2
            });

            var result = sut.ToBuilder().Build().Handlers;

            Assert.That(result, Is.EquivalentTo(new[]
            {
                handler1,
                handler2
            }));
        }
예제 #5
0
        public void DecoratedProjectionHandlersAreCopiedOnConstruction()
        {
            var handler1   = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));
            var handler2   = new RavenProjectionHandler(typeof(object), (connection, message, token) => Task.FromResult(false));
            var projection = new RavenProjection(new[]
            {
                handler1,
                handler2
            });
            var sut = new RavenProjectionBuilder(projection);

            var result = sut.Build();

            Assert.That(result.Handlers, Is.EquivalentTo(new[]
            {
                handler1, handler2
            }));
        }