Added a check to ensure that pulse guide commands fail when the scope is slewing or already being moved on the same axes.
This commit is contained in:
@@ -1322,6 +1322,40 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_utilMock.Verify( x => x.WaitForMilliseconds(duration), Times.Once);
|
||||
}
|
||||
|
||||
[TestCase(GuideDirections.guideEast)]
|
||||
[TestCase(GuideDirections.guideWest)]
|
||||
[TestCase(GuideDirections.guideNorth)]
|
||||
[TestCase(GuideDirections.guideSouth)]
|
||||
public void PulseGuide_WhenSlewingAndPulseGuideAttempted_ThenThrowsExpectedException(GuideDirections direction)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("|");
|
||||
|
||||
var duration = 0;
|
||||
ConnectTelescope();
|
||||
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => { _telescope.PulseGuide(direction, duration); });
|
||||
|
||||
Assert.That(exception.Message, Is.EqualTo("Unable to PulseGuide whilst slewing to target."));
|
||||
}
|
||||
|
||||
[TestCase(GuideDirections.guideEast, TelescopeAxes.axisPrimary)]
|
||||
[TestCase(GuideDirections.guideWest, TelescopeAxes.axisPrimary)]
|
||||
[TestCase(GuideDirections.guideNorth, TelescopeAxes.axisSecondary)]
|
||||
[TestCase(GuideDirections.guideSouth, TelescopeAxes.axisSecondary)]
|
||||
public void PulseGuide_WhenMovingAxisAndPulseGuideAttempted_ThenThrowsExpectedException(GuideDirections direction, TelescopeAxes axes)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("");
|
||||
|
||||
var duration = 0;
|
||||
ConnectTelescope();
|
||||
|
||||
_telescope.MoveAxis(axes, 1);
|
||||
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => { _telescope.PulseGuide(direction, duration); });
|
||||
|
||||
Assert.That(exception.Message, Is.EqualTo("Unable to PulseGuide while moving same axis."));
|
||||
}
|
||||
|
||||
[TestCase(GuideDirections.guideEast)]
|
||||
[TestCase(GuideDirections.guideWest)]
|
||||
[TestCase(GuideDirections.guideNorth)]
|
||||
|
||||
Reference in New Issue
Block a user