public void Init() { // MAKE SURE before you run this test, you MUST change the API key to yours; otherwise the test fails. this._settings = ConverterSettings.CreateInstance(); this._formats = new Formats(); this._wrapper = new ConverterWrapper(this._settings); this._input = new InputParameters() { InputFormat = this._formats.Website.Website, InputMethod = InputMethod.Url, Filepath = "http://www.google.com" }; this._output = new OutputParameters() { DownloadMethod = DownloadMethod.False, OutputStorage = OutputStorage.None, Wait = true }; this._conversion = new ConversionParameters() { OutputFormat = this._formats.Document.Pdf, ConverterOptions = null }; }
public void GetConvertRequest_GivenParameters_ReturnConvertRequest() { var conversion = new ConversionParameters() { OutputFormat = this._formats.Document.Docx, ConverterOptions = new MarkdownConverterOptions() { InputMarkdownSyntax = MarkdownSyntaxType.Auto }, }; var request = this._wrapper.GetConvertRequest(this._input, this._output, conversion); request.InputMethod.Should().Be(InputMethod.Download.ToLower()); request.OutputStorage.Should().Be(OutputStorage.OneDrive.ToLower()); var serialised1 = this._wrapper.Serialise(request); serialised1.Should().Contain("input_markdown_syntax"); conversion = new ConversionParameters() { OutputFormat = this._formats.Document.Docx, ConverterOptions = new Dictionary<string, object>() { { "input_markdown_syntax", MarkdownSyntaxType.Auto }, }, }; request = this._wrapper.GetConvertRequest(this._input, this._output, conversion); request.InputMethod.Should().Be(InputMethod.Download.ToLower()); request.OutputStorage.Should().Be(OutputStorage.OneDrive.ToLower()); var serialised2 = this._wrapper.Serialise(request); serialised2.Should().Contain("input_markdown_syntax"); serialised1.Should().BeEquivalentTo(serialised2); }