public void TestInstallToEmptyResources() { ResourceManager rm = new ResourceManager(String.Empty); IAction pdfAction = new PDFUserAction(); IActionPropertySet pdfPropertySet = new PDFActionPropertySet(); rm.ResourceActions.Add(pdfAction.GetType(), pdfPropertySet.GetType()); // Should now have a single resource action Assert.IsTrue(rm.ResourceActions.Count == 1, "PDF user action not added to empty resources"); ILanguageExtension languageSupport = pdfAction.LanguageSupport; foreach (IResourceAction resourceAction in rm.ResourceActions) { ILanguageExtension languageSupportResource = resourceAction.LanguageSupport; } }
public void TestExecute() { using (WsActivationContext wsac = new WsActivationContext()) { IAction pdfAction = new PDFUserAction(); IActionPropertySet pdfPropertySet = new PDFActionPropertySet(); // Get a word document to convert Stream docStream = System.IO.File.Open(TEST_DOC_DIRECTORY + "small.doc", FileMode.Open); Dictionary<string, string> streamProperties = new Dictionary<string, string>(); streamProperties.Add("DisplayName", "small.doc"); // Just leave all properties with their default values Stream outputStream = pdfAction.Execute(docStream, pdfPropertySet, ref streamProperties); // The output stream should, at least, not be null Assert.IsNotNull(outputStream, "PDF user action output stream is null"); Assert.IsTrue(outputStream.Length > 0, "PDF user action output stream length should be greater than 0"); // Check the name has changed Assert.IsTrue(streamProperties["DisplayName"] == "small.pdf", "DisplayName has not been changed correctly"); } }
public void TestGui() { IAction pdfAction = new PDFUserAction(); IActionPropertySet pdfPropertySet = new PDFActionPropertySet(); PDFUserControl control = new PDFUserControl(); TestShowUserControl frm = new TestShowUserControl(control); frm.ShowDialog(); }