private void doWriteAlignmentEntities(
            IAlignmentEntityEnumerationPolicy enumerationPolicy)
        {
            Document current = DocumentManager.ActiveDocument;

            using (Transaction tr = current.StartTransaction())
            {
                // First we select the alignment to write.
                //
                SingleObjectSelector <Alignment> selector =
                    new SingleObjectSelector <Alignment>();
                if (!selector.Select(current))
                {
                    write("\nNo Alignment was selected.");
                    return;
                }

                // We create the processor and assign the policy.
                //
                AlignmentEntityProcessor processor =
                    new AlignmentEntityProcessor(selector.SelectedId);
                processor.EnumerationPolicy = enumerationPolicy;

                // We create the writer and write the information to it.
                //
                DocumentOutputAlignmentEntityInfoWriter writer =
                    new DocumentOutputAlignmentEntityInfoWriter(current);
                processor.WriteInfo(writer);
            }
        }
Esempio n. 2
0
        public void WriteInformationCorrectly()
        {
            Document doc = getTestDocument();

            using (Transaction tr = doc.StartTransaction())
            {
                ByNameObjectSelector <Alignment> selector =
                    new ByNameObjectSelector <Alignment>();
                selector.ObjectName = "Alignment - (1)";
                selector.Select(doc);
                AlignmentEntityProcessor processor =
                    new AlignmentEntityProcessor(selector.SelectedId);
                processor.EnumerationPolicy = new ByEntityIdEnumerationPolicy();
                AlignmentEntityInfoWriterMock writer =
                    new AlignmentEntityInfoWriterMock();
                processor.WriteInfo(writer);

                Assert.AreEqual(_expectedOutput, writer.Output,
                                "Incorrect information written.");
            }
        }