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 })); }
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)); }
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)); }
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 })); }
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 })); }