Here's a sample code from a test case I wrote. Like I said, the sample from Gallio docs are straightforward. You have to set the test runner to AutoCAD, and then indicate how you want to start AutoCAD but other than that it's pretty easy.
Test Class:
[TestFixture]
public class TestAcad
{
static string dwgfile = @"C:\Users\dave.wolfe.S-VILLE-ECAD\Documents\ECAD\Development\CADWorx Files\PIDTest_10.DWG";
[Test]
public void OpenFile()
{
DrawingManagement.OpenFile(dwgfile);
//now we have to make sure the current document inside of AutoCAD
Document doc = Application.DocumentManager.MdiActiveDocument;
//make sure our file names match
Assert.IsTrue(string.Compare(doc.Name, dwgfile, true) == 0);
}
}
Code to be tested:
public class DrawingManagement
{
/// <summary>
/// Opens a file inside of AutoCAD
/// </summary>
/// <param name="filename"></param>
public static void OpenFile(string filename)
{
//Application.DocumentManager.Open(filename);
ResultBuffer rb = new ResultBuffer();
rb.Add(new TypedValue(5005, "FILEOPEN"));
rb.Add(new TypedValue(5005, filename));
ECAD.AutoCADManager.Commanding.Command(rb);
}
}
You received this message because you are subscribed to the Google Groups "gallio-dev" group.