Working with Aspose.Words in a unit test project

Hi Ali,

Thanks for Quick response could you please help me unit test case for the below

 public class WordConverter : IFileConverter
    {

        MemoryStream outStream;
        MemoryStream licenseStream;
        public WordConverter()
        {
            String path = HttpContext.Current.Server.MapPath("~/App_Code1file/Asposefiles/Aspose.Total.lic");
            if (File.Exists(path))
            {
                this.licenseStream = new MemoryStream(File.ReadAllBytes(path));
            }
        }

        public WordConverter(MemoryStream license)
        {
            this.licenseStream = license;
        }
        public string Convert(byte[] content)
        {

            MemoryStream inStream = new MemoryStream(content);
            outStream = new MemoryStream();
            License licence = new License();           
            if (this.licenseStream != null)
            {
              licence.SetLicense(this.licenseStream);
            }
            
            Document doc = new Document(inStream);

            HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.Html);
            options.ExportImagesAsBase64 = true;
            options.ImageSavingCallback = new HandleImageSaving();

            NodeCollection nodes = doc.GetChildNodes(Aspose.Words.NodeType.Paragraph, true);
            foreach (Paragraph node in nodes)
            {
                node.ParagraphFormat.SpaceAfterAuto = false;
                node.ParagraphFormat.SpaceAfter = 0;
            }

            doc.Save(outStream, options);

            StreamReader reader = new StreamReader(outStream);
            string html = System.Text.Encoding.UTF8.GetString(outStream.ToArray());

            return html;
        }
}

@nagasp

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output HTML file that shows the undesired behavior.
  • Please attach the expected output HTML file that shows the desired behavior.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.