Esempio n. 1
0
        public void Issue1Test_CausingException()
        {
            // Arrange
            const string pathToFile = @"C:\Dev\AutoCADLIGUI\AutoCADLI.Tests\TestFiles\Issue1FailingText.txt";
            var          stringList = ReadLiFile(pathToFile);

            // Act
            var testExtraction = AutoCadliTools.ExtractObjects(stringList, ExtractionObject.PolylinesAndLines);
        }
Esempio n. 2
0
        public void ArcExtractionTest()
        {
            var stringList        = ReadLiFile(@"C:\Dev\AutoCADLIGUI\AutoCADLI.Tests\TestFiles\ArcsTest.txt");
            var arcTestExtraction = AutoCadliTools.ExtractObjects(stringList, ExtractionObject.PolylinesAndLines);

            var totalLength = 0.0;

            foreach (var item in arcTestExtraction)
            {
                totalLength += item;
            }
            Assert.IsTrue(Math.Abs(totalLength - 2.318) < 0.001);
        }
Esempio n. 3
0
        public void ThreeDLengthTest()
        {
            // Arrange
            const string pathToFile = @"C:\Dev\AutoCADLIGUI\AutoCADLI.Tests\TestFiles\3DLength.txt";

            // Act
            var stringList     = ReadLiFile(pathToFile);
            var testExtraction = AutoCadliTools.ExtractObjects(stringList, ExtractionObject.PolylinesAndLines);
            var numberOfItems  = testExtraction.Count;

            // Assert
            Assert.IsTrue(numberOfItems == 1);
            Assert.IsTrue(Math.Abs(testExtraction[0] - 18.8941) < 0.01);
        }
Esempio n. 4
0
        public void PolylineLineExtractionTests()
        {
            var stringList = ReadLiFile(PolylineLineTestFile);
            // testing extraction of Polylines and Lines
            var testExtractionPolylines = AutoCadliTools.ExtractObjects(stringList,
                                                                        ExtractionObject.PolylinesAndLines);

            // Total length tests
            var totalLength = 0.0;

            foreach (var obj in testExtractionPolylines)
            {
                totalLength += obj;
            }
            // Assertion test for length extraction
            Assert.IsTrue(Math.Abs(totalLength - 693.7963) < 0.0001);


            // Printing of all the lines in the stringList
#if false
            foreach (var line in stringList)
            {
                Debug.WriteLine(line);
            }
            #endif

            // Printing of all of the lengths in the polylines and lines list
#if false
            foreach (var extractedObj in testExtractionPolylines)
            {
                Debug.WriteLine(extractedObj);
            }
            #endif

            // testing extraction of hatches
            var testExtractionHatches = AutoCadliTools.ExtractObjects(stringList,
                                                                      ExtractionObject.Hatches);
        }
Esempio n. 5
0
        public void HatchExtractionTests()
        {
            var stringList = ReadLiFile(HatchTestFile);
            // Run the extraction code
            var testHatchExtraction = AutoCadliTools.ExtractObjects(stringList,
                                                                    ExtractionObject.Hatches);

            var totalArea = 0.0;

            foreach (var area in testHatchExtraction)
            {
                totalArea += area;
            }
            Assert.IsTrue(Math.Abs(MathTools.Convert(totalArea, Conversions.M2Ha) - 1.64679315) < 0.0001,
                          "Total Area: " + totalArea);

#if false
            foreach (var listContents in testHatchExtraction)
            {
                Debug.WriteLine(listContents);
            }
            #endif
        }