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

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

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

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

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

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

                // Assert
                Assert.AreEqual(10, projection.ProjectionProperty);
            }
Exemplo n.º 4
0
            public void Should_add_using_only_projection_property_name()
            {
                // Arrange
                var message = new TestMessage {
                    MappedByName = 10
                };
                var projection = new TestProjection {
                    MappedByName = 10
                };
                var builder = new AddNewProjectionStrategyArguments <TestMessage, TestProjection>();

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

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

                // Assert
                Assert.AreEqual(20, projection.MappedByName);
            }
Exemplo n.º 5
0
            public void Should_add_to_projection()
            {
                // Arrange
                var message = new TestMessage {
                    MessageProperty = 5
                };
                var projection = new TestProjection {
                    ProjectionProperty = 5
                };
                var builder = new AddNewProjectionStrategyArguments <TestMessage, TestProjection>();

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

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

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

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

                // Assert
                Assert.Throws<ArgumentOutOfRangeException>(@delegate);
            }