コード例 #1
0
        public void TrimObjectExtensions_TrimDoesNotThrowIfGetThrows_Object()
        {
            // Arrange
            var testObj = new ObjectThatThrowsOnGet <object>(" A value in need of trimming. ");

            // Act & Assert (we are just testing that an exception is not thrown here.
            testObj.TrimStringProperties();
        }
コード例 #2
0
        public void TrimObjectExtensions_TrimDoesNotThrowIfGetThrows_ComplexObject()
        {
            // Arrange
            var testObj = new TestObject {
                Value = " A value in need of trimming. ", Sub = new SubTestObject {
                    SubValue = " A sub value in need of trimming. "
                }
            };
            var testObjThatThrows = new ObjectThatThrowsOnGet <TestObject>(testObj);

            // Act & Assert (we are just testing that an exception is not thrown here.
            testObjThatThrows.TrimStringProperties();

            // Assert
            Assert.AreEqual(" A value in need of trimming. ", testObj.Value);
            Assert.AreEqual(" A sub value in need of trimming. ", testObj.Sub.SubValue);
        }