public void Test_SubGrid_SetAbsoluteOriginPosition() { ISubGrid subgrid = null; SubGridTree tree = new SubGridTree(SubGridTreeConsts.SubGridTreeLevels, 1.0, new SubGridFactory <NodeSubGrid, LeafSubGrid>()); subgrid = new SubGrid(tree, null, 2); // create a node to be a chile of the root node // Test setting origin for unattached subgrid subgrid.SetAbsoluteOriginPosition(100, 100); Assert.True(subgrid.OriginX == 100 && subgrid.OriginY == 100, "SetAbsoluteOriginPosition did not set origin position for subgrid"); // Add subgrid to the root (which will set it's parent and prevent the origin position from // being changed and will throw an exception) tree.Root.SetSubGrid(0, 0, subgrid); try { subgrid.SetAbsoluteOriginPosition(100, 100); Assert.True(false, "Setting absolute position for node with a parent did not raise an exception"); } catch (Exception) { // As expected` } }