Beispiel #1
0
        public void OpenFileAsyncNotExistingFile()
        {
            var notexistNc = @".\notexist.nc";
            var preparer   = new GCodePreparer();

            Assert.ThrowsAsync <FileNotFoundException>(async() => await preparer.OpenFileAsync(notexistNc, new Progress <float>()));
        }
Beispiel #2
0
        public void OpenFileAsyncTestValidFile()
        {
            var validFilePath = @".\TestFiles\valid.nc";
            var preparer      = new GCodePreparer();

            Assert.DoesNotThrowAsync(async() => await preparer.OpenFileAsync(validFilePath, new Progress <float>()));
        }
Beispiel #3
0
        public async Task PrepareStringsAsyncTest()
        {
            var validFilePath = @".\TestFiles\valid.nc";
            var preparer      = new GCodePreparer();
            await preparer.OpenFileAsync(validFilePath, new Progress <float>());

            try
            {
                await preparer.PrepareStringsAsync();
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            Assert.Pass();
        }
Beispiel #4
0
        public virtual async Task LoadProgramAsync(string path, IProgress <float> progressChanger)
        {
            progressChanger.Report(0);
            Program.Clear();
            progressChanger.Report(1);
            GCodePreparer preparer = new GCodePreparer();
            await preparer.OpenFileAsync(path, progressChanger);

            progressChanger.Report(5);
            await preparer.PrepareStringsAsync();

            progressChanger.Report(10);

            await InterpretProgram(preparer, progressChanger);

            if (Program.Count == 0)
            {
                return;
            }
            FrameNumber  = 0;
            CurrentFrame = Program[FrameNumber];
            InitFrame();
            progressChanger.Report(100);
        }