public void InvalidFileFormat() { var exception = new InvalidFileFormatException("invalid format"); var observedExitCode = ExitCodeUtilities.ShowException(exception); Assert.Equal((int)ExitCodes.InvalidFileFormat, observedExitCode); }
private XcpUnpack _unpackerInstance; //Todo:Confirm this object properly manages memory internally (within XcpPackage.sln) public XcpInstance(string xcpPath, string outputFolder, bool start, bool cleanup, PackageBase pb) : base(pb) { if (string.IsNullOrWhiteSpace(Title) || (pb == null)) { Title = Path.GetFileNameWithoutExtension(xcpPath); Status = PackageStatus.Waiting; } InFile = xcpPath; OutFolder = outputFolder + @"\" + Path.GetFileNameWithoutExtension(InFile); OutFile = null; _cleanup = cleanup; _unpackerInstance = new XcpUnpack(InFile); _unpackerInstance.UnpackAndSplitProgressChanged += XcpInstance_UnpackAndSplitProgressChanged; _unpackerInstance.UnpackProgressChanged += XcpInstance_UnpackProgressChanged; _unpackerInstance.SplitProgressChanged += XcpInstance_SplitProgressChanged; if (string.Compare(Path.GetExtension(InFile), ".xcp", StringComparison.OrdinalIgnoreCase) == 0) { if (start) { FullExtract(); } } else if (string.Compare(Path.GetExtension(InFile), ".xup", StringComparison.OrdinalIgnoreCase) == 0) { if (start) { Split(); } } else { Error = new InvalidFileFormatException("File extension not Handled (Please Use *.xcp or *.xup)"); } }
public void Test6() { InvalidFileFormatException exception = Assert.Throws <InvalidFileFormatException>(() => converter.Convert(@"Tests\Test 6\Convert.txt")); Assert.AreEqual(exception.Message, "The file with the input data contains an invalid Metric Unit"); }
public void Test5() { InvalidFileFormatException exception = Assert.Throws <InvalidFileFormatException>(() => converter.Convert(@"Tests\Test 5\Convert.txt")); Assert.AreEqual(exception.Message, "The file with the input data does not have a valid format"); }
public void Test4() { InvalidFileFormatException exception = Assert.Throws <InvalidFileFormatException>(() => converter.Convert(@"Tests\Test 4\Convert.txt")); Assert.AreEqual(exception.Message, "The file with the input data does not have the expected amount of columns"); }