public void InitializeConfigFile_InstalledFileExists_UserFileNotExists_CopyFileAndReturnTrue()
        {
            string installedFilePath = "installedFilePath";
            string userFilePath      = "userFilePath";
            IFileSystemOperation mockFileSystemOperator = MockRepository.GenerateMock <IFileSystemOperation>();

            mockFileSystemOperator.Stub(s => s.FileExists(installedFilePath)).Return(true);
            mockFileSystemOperator.Stub(s => s.FileExists(userFilePath)).Return(false);
            OptimizedTarget target = new OptimizedTarget(null, mockFileSystemOperator);

            bool installedFileExistsUserFileNotExistsResult = target.InitializeConfigFile(installedFilePath, userFilePath);

            mockFileSystemOperator.AssertWasCalled(s => s.FileCopy(installedFilePath, userFilePath));
            Assert.IsTrue(installedFileExistsUserFileNotExistsResult);
        }
        public void InitializeConfigFile_InstalledFileExists_UserFileNotExists_ThrowException_ReturnFalse()
        {
            string installedFilePath = "installedFilePath";
            string userFilePath      = "userFilePath";
            IFileSystemOperation mockFileSystemOperator = MockRepository.GenerateMock <IFileSystemOperation>();

            mockFileSystemOperator.Stub(s => s.FileExists(installedFilePath)).Return(true);
            mockFileSystemOperator.Stub(s => s.FileExists(userFilePath)).Return(false);
            mockFileSystemOperator.Stub(s => s.FileCopy("", "")).IgnoreArguments().Throw(new Exception());
            OptimizedTarget target = new OptimizedTarget(null, mockFileSystemOperator);

            bool throwExceptionResult = target.InitializeConfigFile(installedFilePath, userFilePath);

            mockFileSystemOperator.AssertWasCalled(s => s.FileCopy(installedFilePath, userFilePath));
            Assert.IsFalse(throwExceptionResult);
        }