Example #1
0
        public void TryDeleteDocumentItem()
        {
            var id = "13F0CBA5-C2E7-4251-86BE-59CC01AD49FD";
            var identificationNumber = "4DDE638F-7632-4A77-8FE8-7B62C06AE154"; // "8dfdd485-68f2-48cd-883b-cc0f43e94fd2";
            var typeId = "A07C5CE3-659C-4FCC-A60B-5CCB6E26B8A4";               // "1b453a59-b318-4e14-8684-83f0b78fa8a1";

            Debug.WriteLine(identificationNumber);
            IContactProvider p = ContactProviderFactory.CreateProvider();
            var savedDocument  = p.SaveDocumentItem(new DocumentItem {
                Id = id, IdentificationNumber = identificationNumber, TypeId = typeId, IssueDate = DateTime.Now
            });

            Debug.WriteLine(savedDocument.ToString());


            using (TransactionScope scope = new TransactionScope())
            {
                p.DeleteDocumentItem(id);
            }
            var result1 = p.GetDocumentItem(id);

            Assert.IsNotNull(result1);


            using (TransactionScope scope = new TransactionScope())
            {
                var result2 = p.DeleteDocumentItem(id);
                scope.Complete();
            }
            var result3 = p.GetDocumentItem(id);

            Assert.IsNull(result3);
        }