예제 #1
0
        public void ThrowExceptionWhenCreatingOutsideOfTransaction()
        {
            var collector   = new CollectorService();
            var wallService = new WallCreatorService(collector);
            var line        = Line.CreateBound(XYZ.Zero, XYZ.BasisY.Multiply(10));

            Assert.Throws <ModificationOutsideTransactionException>(() => wallService.CreateWall(doc, line));
        }
예제 #2
0
        public void CreateWall()
        {
            var collector   = new CollectorService();
            var wallService = new WallCreatorService(collector);
            var line        = Line.CreateBound(XYZ.Zero, XYZ.BasisX.Multiply(10));

            Wall wall;

            using (Transaction t = new Transaction(this.doc, "Create Wall"))
            {
                t.Start();
                wall = wallService.CreateWall(doc, line);
                t.Commit();
            }

            Assert.NotNull(wall);
        }