public void CopyPropertiesTo_ShouldntCopyProps_WhenUnavailable(int idValue) { var dest = new DestinationDTO(); var src = new SourceDTO() { DifferentId = idValue }; src.CopyPropertiesTo(dest); dest.DifferentId.Should().Be(null); }
public void CopyPropertiesTo_ShouldCopyProps_WhenAvailable(int idValue) { var dest = new DestinationDTO(); var src = new SourceDTO() { Id = idValue }; src.CopyPropertiesTo(dest); dest.Id.Should().Be(idValue); }
public void CopyPropertiesTo_ShouldntThrowError_WhenEmptyClass() { var empty = new EmptyDTO(); var src = new SourceDTO() { Id = 1 }; Action copyToEmpty = () => src.CopyPropertiesTo(empty); Action copyFromEmpty = () => empty.CopyPropertiesTo(src); copyToEmpty.Should().NotThrow(); copyFromEmpty.Should().NotThrow(); }
public void CopyPropertiesTo_ShouldntCopyProps_WhenUnwrittable(int idValue) { var dest = new DestinationDTO(); var src = new SourceDTO() { UnwritableIdOnDest = idValue }; src.CopyPropertiesTo(dest); src.UnwritableIdOnDest.Should().Be(idValue); dest.UnwritableIdOnDest.Should().Be(null); }