コード例 #1
0
        public void CopyPropertyValuesFrom_NullSource_SourceStaysNull()
        {
            // Arrange
            var now     = DateTime.UtcNow;
            var testObj = new { Id = SampleNumbers.int2, name = SampleStrings.str1, dateTime = now, comment = SampleStrings.str2, test = SampleStrings.str3, Trouble = SampleNumbers.int1 };

            #pragma warning disable CS8600 // Testing null value to non-nullable type.
            SampleObject testClass = null;
            #pragma warning restore CS8600

            // Act
            testClass.CopyPropertyValuesFrom(testObj);

            // Assert
            testClass.Should().BeNull("Source will not be initialized.");
        }