public void ToolFormatConverter_ConvertToStandardFormat_DirectorySpecifiedAsDestination() { string input = Path.GetTempFileName(); string directory = Environment.CurrentDirectory; _converter.ConvertToStandardFormat(ToolFormat.AndroidStudio, input, directory); }
public void ToolFormatConverter_FailsIfPluginAssemblyCannotBeLoaded() { using (var tempDir = new TempDirectory()) { const string ToolName = "TestTool"; string PluginAssemblyPath = GetCurrentAssemblyPath(); string inputFilePath = tempDir.Write("input.txt", string.Empty); string outputFilePath = tempDir.Combine("output.txt"); // Unlike all the other tests, which default-construct the converter, this test // provides the converter with a delegate which simulates the failure to load the // plugin assembly. const string Message = "Something went dreadfully wrong."; AssemblyLoadFileDelegate assemblyLoadFileDelegate = path => throw new BadImageFormatException(Message); var converter = new ToolFormatConverter(assemblyLoadFileDelegate); Action action = () => converter.ConvertToStandardFormat( ToolName, inputFilePath, outputFilePath, LoggingOptions.None, OptionallyEmittedData.None, PluginAssemblyPath); // The attempt to convert the file should throw the same exception. action.Should().Throw <BadImageFormatException>().WithMessage(Message); } }
public void ToolFormatConverter_ConvertToStandardFormat_DirectorySpecifiedAsDestination() { string input = Path.GetTempFileName(); string directory = Environment.CurrentDirectory; Action action = () => _converter.ConvertToStandardFormat(ToolFormat.AndroidStudio, input, directory); action.Should().Throw <ArgumentException>(); }
public void ToolFormatConverter_ConvertToStandardFormat_NullInputFile() { string file = Path.GetTempFileName(); Action action = () => _converter.ConvertToStandardFormat(ToolFormat.AndroidStudio, null, file); action.Should().Throw <ArgumentNullException>(); }