public void TryRemove_ThrowsPathNotFoundException_ForNonExistingProperty()
        {
            // Arrange
            var     adapter  = new DynamicObjectAdapter();
            dynamic target   = new DynamicTestObject();
            var     segment  = "NewProperty";
            var     resolver = new DefaultContractResolver();

            // Act
            var removeStatus = adapter.TryRemove(target, segment, resolver, out string removeErrorMessage);

            // Assert
            Assert.False(removeStatus);
            Assert.Equal($"The target location specified by path segment '{segment}' was not found.", removeErrorMessage);
        }
        public void TryRemove_SetsPropertyToDefaultOrNull(object value, object expectedValue)
        {
            // Arrange
            var     adapter  = new DynamicObjectAdapter();
            dynamic target   = new DynamicTestObject();
            var     segment  = "NewProperty";
            var     resolver = new DefaultContractResolver();

            // Act 1
            var addStatus = adapter.TryAdd(target, segment, resolver, value, out string errorMessage);

            // Assert 1
            Assert.True(addStatus);
            Assert.Null(errorMessage);
            Assert.Equal(value, target.NewProperty);

            // Act 2
            var removeStatus = adapter.TryRemove(target, segment, resolver, out string removeErrorMessage);

            // Assert 2
            Assert.True(removeStatus);
            Assert.Null(removeErrorMessage);
            Assert.Equal(expectedValue, target.NewProperty);
        }