public void TestPostAssembleDocument() { var fileName = "TableFeatures.odt"; var dataName = "TableData.json"; var data = File.ReadAllText(Path.Combine(BaseTestContext.LocalTestDataFolder, dataName)); var saveOptions = new AssembleOptions() { SaveFormat = "pdf", ReportData = data, TemplateFileInfo = new TemplateFileInfo { FilePath = Path.Combine(BaseTestContext.RemoteBaseTestDataFolder, "GroupDocs.Assembly", fileName) } }; this.UploadFileToStorage(Path.Combine(BaseTestContext.RemoteBaseTestDataFolder, "GroupDocs.Assembly", fileName), null, null, File.ReadAllBytes(Path.Combine(BaseTestContext.LocalTestDataFolder, fileName))); var request = new AssembleDocumentRequest(saveOptions); var result = this.AssemblyApi.AssembleDocument(request); Assert.IsTrue(result.Length > 0, "Error occurred while assemble document"); }
public void Asm_command_tests(string name) { // Arrange var content = _testSource.VrilFiles[name]; var expected = _testSource.BinFiles[name]; var options = new AssembleOptions() { FilePath = name }; var reader = MockFactory.NewFileReader(content); var writer = MockFactory.NewFileWriter(); var configuration = MockFactory.NewConfiguration(); // Act AssembleCommand.Run(options, reader, writer, configuration); // Assert var file = Assert.Single(writer.Files.Values); var actual = Assert.IsType <byte[]>(file); Assert.True(Enumerable.SequenceEqual(expected, actual)); }
public void TestPostAssembleDocumentThrows() { var fileName = "TableFeatures.odt"; var saveOptions = new AssembleOptions() { SaveFormat = "pdf", ReportData = string.Empty, TemplateFileInfo = new TemplateFileInfo { FilePath = Path.Combine(BaseTestContext.RemoteBaseTestDataFolder, "GroupDocs.Assembly", fileName) } }; this.UploadFileToStorage(Path.Combine(BaseTestContext.RemoteBaseTestDataFolder, "GroupDocs.Assembly", fileName), null, null, File.ReadAllBytes(Path.Combine(BaseTestContext.LocalTestDataFolder, fileName))); var request = new AssembleDocumentRequest(saveOptions); try { this.AssemblyApi.AssembleDocument(request); } catch (ApiException e) { Assert.AreEqual(400, e.ErrorCode); Assert.AreEqual("assembleOptions.ReportData is required in the request body.", e.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="AssembleDocumentRequest"/> class. /// </summary> /// <param name="argAssembleOptions">Assemble Options. It should be JSON with TemplateName, SaveFormat, ReportData and etc. </param> public AssembleDocumentRequest(AssembleOptions argAssembleOptions) { this.AssembleOptions = argAssembleOptions; }
private static void Assemble(AssembleOptions options) {