예제 #1
0
        public void TestCreateAndDeleteDocument()
        {
            DMLogin.ServerName = DMTestEnvironment.Server;
            DMLogin.Password = TestHelperSecure.MyPassword;
            string dst = DMLogin.Dst;
            string newDocName = Guid.NewGuid().ToString();

            ProfileInfo profile = new ProfileInfo() { FormName = "STANDARD_P" };
            profile.Properties = new Dictionary<string, string>() {
                    { "DOCNAME", newDocName },
                    { "APP_ID", "NOTEPAD" },
                    { "AUTHOR_ID", "JDOE" },
                    { "TYPIST_ID", "JDOE" }
                };
            DMDocument doc = new DMDocument() { Dst = dst, Library = DMLogin.Library };

            string fileName = Path.GetTempFileName();
            File.WriteAllText(fileName, "hello world!\r\n");
            try {
                var docInfo = doc.CreateDocument(profile, fileName);
                Assert.IsNotNull(docInfo);
                Assert.IsTrue(docInfo.DocNumber > 0);
                Assert.IsTrue(docInfo.VersionID > 0);
                //TODO download content and check

                doc.DeleteProfile(docInfo.DocNumber);
            }
            finally {
                File.Delete(fileName);
            }
        }