示例#1
0
        public void TrimObjectExtensions_TrimDoesNotThrowIfSetThrows_Object()
        {
            // Arrange
            var testObj = new ObjectThatThrowsOnSet <object>(" A value in need of trimming. ");

            // Act
            testObj.TrimStringProperties();

            // In a Tuple, Item1 and Item2 are readonly and immutable and cannot change.

            // Assert - doesn't throw exception and regular stuff is trimmed
            Assert.AreEqual(" A value in need of trimming. ", testObj.Value);
        }
示例#2
0
        public void TrimObjectExtensions_TrimDoesNotThrowIfSetThrows_ComplexObject()
        {
            // Arrange
            var testObj = new TestObject {
                Value = " A value in need of trimming. "
            };
            var testObjThatThrows = new ObjectThatThrowsOnSet <TestObject>(testObj);

            // Act
            testObjThatThrows.TrimStringProperties();

            // In a Tuple, Item1 and Item2 are readonly and immutable and cannot change.

            // Assert - Set on Complex object, shouldn't happen, so trimming should work on child object.
            Assert.AreEqual("A value in need of trimming.", testObj.Value);
        }