Esempio n. 1
0
            public void Should_throw_if_no_message_property_found_for_conventional_mapping()
            {
                // Arrange
                var builder = new AddNewProjectionStrategyArguments <TestMessage, TestProjection>();

                // Act
                var @delegate = new TestDelegate(() => builder.Map(p => p.NoMessageProperty));

                // Assert
                Assert.Throws <ArgumentOutOfRangeException>(@delegate);
            }
Esempio n. 2
0
            public void Should_map_using_only_projection_property_name()
            {
                // Arrange
                var message = new TestMessage {
                    MappedByName = 555
                };
                var projection = new TestProjection();
                var builder    = new AddNewProjectionStrategyArguments <TestMessage, TestProjection>();

                builder.Map(p => p.MappedByName);

                // Act
                builder.Mappers.Map(message, projection);

                // Assert
                Assert.AreEqual(message.MappedByName, projection.MappedByName);
            }
Esempio n. 3
0
            public void Should_map_to_projection()
            {
                // Arrange
                var message = new TestMessage {
                    MessageProperty = 777
                };
                var projection = new TestProjection();
                var builder    = new AddNewProjectionStrategyArguments <TestMessage, TestProjection>();

                builder.Map(p => p.ProjectionProperty, e => e.MessageProperty);

                // Act
                builder.Mappers.Map(message, projection);

                // Assert
                Assert.AreEqual(message.MessageProperty, projection.ProjectionProperty);
            }
            public void Should_throw_if_no_message_property_found_for_conventional_mapping()
            {
                // Arrange
                var builder = new AddNewProjectionStrategyArguments<TestMessage, TestProjection>();

                // Act
                var @delegate = new TestDelegate(() => builder.Map(p => p.NoMessageProperty));

                // Assert
                Assert.Throws<ArgumentOutOfRangeException>(@delegate);
            }
            public void Should_map_using_only_projection_property_name()
            {
                // Arrange
                var message = new TestMessage {MappedByName = 555};
                var projection = new TestProjection();
                var builder = new AddNewProjectionStrategyArguments<TestMessage, TestProjection>();
                builder.Map(p => p.MappedByName);

                // Act
                builder.Mappers.Map(message, projection);

                // Assert
                Assert.AreEqual(message.MappedByName, projection.MappedByName);
            }
            public void Should_map_to_projection()
            {
                // Arrange
                var message = new TestMessage {MessageProperty = 777};
                var projection = new TestProjection();
                var builder = new AddNewProjectionStrategyArguments<TestMessage, TestProjection>();
                builder.Map(p => p.ProjectionProperty, e => e.MessageProperty);

                // Act
                builder.Mappers.Map(message, projection);

                // Assert
                Assert.AreEqual(message.MessageProperty, projection.ProjectionProperty);
            }
            public void Should_map_to_projection()
            {
                // Arrange
                var @event = new TestEvent {EventProperty = 777};
                var projection = new TestProjection();
                var builder = new AddNewProjectionStrategyArguments<TestEvent, TestProjection>();
                builder.Map(p => p.ProjectionProperty, e => e.EventProperty);

                // Act
                builder.Mappers.Map(@event, projection);

                // Assert
                Assert.AreEqual(@event.EventProperty, projection.ProjectionProperty);
            }