public void AddAdditional_CriticalException_IsNotCaught()
        {
            var projectMock = Mock.Of <EnvDTE.Project>();

            var projectSystemMock = new Mock <IProjectSystemHelper>();

            projectSystemMock.Setup(x => x.AddFileToProject(projectMock, It.IsAny <string>(), It.IsAny <string>()))
            .Throws <StackOverflowException>();

            Action act = () => CSharpVBBindingOperation.AddAdditionalFileToProject(projectSystemMock.Object, projectMock, "any file");

            act.Should().ThrowExactly <StackOverflowException>();
        }
        public void AddAdditional_NonCriticalException_IsCaughtAndWrapped()
        {
            var projectMock    = new ProjectMock("any.proj");
            var innerException = new InvalidCastException("inner exception message");

            var projectSystemMock = new Mock <IProjectSystemHelper>();

            projectSystemMock.Setup(x => x.AddFileToProject(projectMock, It.IsAny <string>(), Constants.AdditionalFilesItemTypeName))
            .Throws(innerException);

            Action act = () => CSharpVBBindingOperation.AddAdditionalFileToProject(projectSystemMock.Object, projectMock, "anyFile.txt");

            act.Should().ThrowExactly <SonarLintException>()
            .Where(x => x.Message.Contains(projectMock.FilePath) &&
                   x.Message.Contains(innerException.Message))
            .And.InnerException.Should().BeSameAs(innerException);
        }