public void GetEvalutedPropertyValue_CriticalException_IsNotSuppressed()
        {
            // Arrange
            var dummyEngine = new DummyProjectEngine();

            dummyEngine.TestOp = _ => { throw new StackOverflowException("foo"); };

            // Act and Assert
            Action act = () =>
                         CFamilyHelper.FileConfig.GetPotentiallyUnsupportedPropertyValue(dummyEngine, "propertyName1",
                                                                                         "default xxx");

            act.Should().ThrowExactly <System.Reflection.TargetInvocationException>()
            .WithInnerException <StackOverflowException>().And.Message.Should().Be("foo");
        }
        public void GetEvalutedPropertyValue_Exception_ReturnsDefault()
        {
            // Arrange
            var dummyEngine = new DummyProjectEngine();

            bool delegateCalled = false;

            dummyEngine.TestOp = pn =>
            {
                delegateCalled = true;
                throw new InvalidOperationException("foo");
            };

            // Act - exception should be handled
            var result =
                CFamilyHelper.FileConfig.GetPotentiallyUnsupportedPropertyValue(dummyEngine, "propertyName1",
                                                                                "default xxx");

            // Assert
            result.Should().Be("default xxx");
            delegateCalled.Should().BeTrue(); // Sanity check that the test delegate was invoked
        }
        public void GetEvalutedPropertyValue_NoException_ReturnsValue()
        {
            // Arrange
            var dummyEngine = new DummyProjectEngine();

            string suppliedPropertyName = null;

            dummyEngine.TestOp = pn =>
            {
                suppliedPropertyName = pn;
                return("propertyValue");
            };

            // Act
            var result =
                CFamilyHelper.FileConfig.GetPotentiallyUnsupportedPropertyValue(dummyEngine, "propertyName1",
                                                                                "default xxx");

            // Assert
            result.Should().Be("propertyValue");
            suppliedPropertyName.Should().Be("propertyName1");
        }