public void CopyManager_UseIgnoreList_ShouldOnlyCopyUnignoredFiles() { // arrange var helper = new CopyManagerTestHelper(); helper.ArrangeTypicalScenario("Copying", _sourceRootFolder, _destinationRootFolder, "File2.txt"); var copier = new CopyManager(_sourceRootFolder, _destinationRootFolder, helper.MockHelper.Object, false); // act var isCopySuccess = copier.CopyFiles(); // assert Assert.That(isCopySuccess, Is.True, "Not Successful"); Assert.That(copier.FileCopyLog, Is.EqualTo(helper.ExpectedFileLog.ToString()), "Wrong File List"); }
public void CopyManager_ExceptionThrown_ShouldSucceed() { // arrange var fileInUseText = "File in use"; var sourceFile = Path.Combine(_sourceRootFolder, "File1.txt"); var destinationFile = Path.Combine(_destinationRootFolder, "File1.txt"); var expectedErrorInfo = string.Format("ERROR: Unable to copy {0}\r\nMessage: {1}\r\nDetails: System.IO.IOException: {1}\r\n", sourceFile, fileInUseText); var helper = new CopyManagerTestHelper(); helper.ArrangeTypicalScenario("Copying", _sourceRootFolder, _destinationRootFolder, string.Empty); helper.MockHelper.Setup(x => x.FileCopy(sourceFile, destinationFile, true)).Throws(new IOException(fileInUseText)); var copier = new CopyManager(_sourceRootFolder, _destinationRootFolder, helper.MockHelper.Object, false); // act var isCopySuccess = copier.CopyFiles(); // assert Assert.That(isCopySuccess, Is.True, "Not Successful"); Assert.That(copier.FileCopyLog.Contains(expectedErrorInfo), Is.True, "File Copy Log missing error info\r\nCopy Log:" + copier.FileCopyLog); }
private void DoTypicalScenario(string copyActionText, bool isPreview) { // arrange var helper = new CopyManagerTestHelper(); helper.ArrangeTypicalScenario(copyActionText, _sourceRootFolder, _destinationRootFolder, "debug"); var copier = new CopyManager(_sourceRootFolder, _destinationRootFolder, helper.MockHelper.Object, isPreview); // act var isCopySuccess = copier.CopyFiles(); // assert Assert.That(isCopySuccess, Is.True, "Not Successful"); Assert.That(copier.FileCopyLog, Is.EqualTo(helper.ExpectedFileLog.ToString()), "Wrong File List"); }