public void WhenAnErrorIsAdded_ContainsError_ShouldBeTrue() { var result = new TaskResult (); result.Error ("my error"); result.ContainsError ().ShouldBe (true); }
TaskResult IExecutable.Execute() { var result = new TaskResult(); if (_exactFileExists) { result.Success (Destination + " already exists with matching file contents."); return result; } var destInfo = new FileInfo (Destination); DetectAndAppendCopyErrorsToResult (result, destInfo); if (result.ContainsError()) return result; if (destInfo.Exists && destInfo.IsReadOnly) { destInfo.IsReadOnly = false; File.Copy (Source, Destination, true); destInfo.IsReadOnly = true; } else { File.Copy (Source, Destination, true); } result.Success ("{0} successfully copied to {1}.", Source, Destination); return result; }
public void WhenNoErrorsAdded_ContainsError_ShouldBeFalse() { var result = new TaskResult (); result.ContainsError().ShouldBe (false); }