Esempio n. 1
0
        public void AddCadObject()
        {
            Line        line = new Line();
            CadDocument doc  = new CadDocument();

            doc.BlockRecords[BlockRecord.ModelSpaceName].Entities.Add(line);

            CadObject l = doc.GetCadObject(line.Handle);

            //Assert existing element
            Assert.NotNull(l);
            Assert.Equal(line, l);
            Assert.False(0 == l.Handle);
            Assert.Equal(line.Handle, l.Handle);
        }
Esempio n. 2
0
        private static void assertTable <T>(CadDocument doc, Table <T> table)
            where T : TableEntry
        {
            Assert.NotNull(table);

            notNull(table.Document, $"Document not assigned to table {table}");
            Assert.Equal(doc, table.Document);
            Assert.Equal(doc, table.Owner);

            Assert.True(table.Handle != 0);

            CadObject t = doc.GetCadObject(table.Handle);

            Assert.Equal(t, table);

            foreach (T entry in table)
            {
                Assert.Equal(entry.Owner.Handle, table.Handle);
                Assert.Equal(entry.Owner, table);

                documentObjectNotNull(doc, entry);
            }
        }
Esempio n. 3
0
 private static void documentObjectNotNull <T>(CadDocument doc, T o)
     where T : CadObject
 {
     Assert.True(doc.GetCadObject(o.Handle) != null, $"Object of type {typeof(T)} | {o.Handle} not found in the doucment");
 }