Пример #1
0
        public void Can_merge_type_with_property_setters(
            string sourceId, string sourceName, int?sourceAge,
            string withId, string withName, int?withAge,
            string expectedId, string expectedName, int?expectedAge)
        {
            // Arrange
            var source = new TypeWithPropertySetters
            {
                Id   = sourceId,
                Name = sourceName,
                Age  = sourceAge
            };
            var destination = new TypeWithPropertySetters
            {
                Id   = withId,
                Name = withName,
                Age  = withAge
            };

            // Act
            var result = source.Merge(destination);

            // Assert
            result.Should().BeOfType <TypeWithPropertySetters>();
            result.Age.Should().Be(expectedAge);
            result.Id.Should().Be(expectedId);
            result.Name.Should().Be(expectedName);
        }
Пример #2
0
        public void Can_merge_from_property_to_property(
            string sourceId, string sourceName, int?sourceAge,
            string destinationId, string destinationName, int?destinationAge,
            string expectedId, string expectedName, int?expectedAge)
        {
            // Arrange
            var source = new TypeWithPropertySetters
            {
                Id   = sourceId,
                Age  = sourceAge,
                Name = sourceName
            };
            var destination = new TypeWithPropertySetters
            {
                Id   = destinationId,
                Age  = destinationAge,
                Name = destinationName
            };

            // Act
            var result = source.Merge(destination);

            // Assert
            result.Should().BeOfType <TypeWithPropertySetters>();
            result.Age.Should().Be(expectedAge);
            result.Id.Should().Be(expectedId);
            result.Name.Should().Be(expectedName);
        }
Пример #3
0
            public void Calling_Merge_creates_a_new_instance()
            {
                // Arrange
                var source      = new TypeWithPropertySetters();
                var destination = new TypeWithPropertySetters();

                // Act
                var result = source.Merge(destination);

                // Assert
                result.GetHashCode().Should().NotBe(source.GetHashCode());
            }