Added unit tests for the new Pulse guide implementation.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
using ASCOM;
|
using ASCOM;
|
||||||
|
using ASCOM.DeviceInterface;
|
||||||
using ASCOM.MeadeAutostar497.Controller;
|
using ASCOM.MeadeAutostar497.Controller;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -384,8 +385,6 @@ namespace MeadeAutostar497.UnitTests
|
|||||||
Assert.That(exception.Message, Is.EqualTo("Failed to set site longitude."));
|
Assert.That(exception.Message, Is.EqualTo("Failed to set site longitude."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void SiteLongitude_Set_NoErrorWhenValidValueSentSuccessfully()
|
public void SiteLongitude_Set_NoErrorWhenValidValueSentSuccessfully()
|
||||||
{
|
{
|
||||||
@@ -397,5 +396,53 @@ namespace MeadeAutostar497.UnitTests
|
|||||||
|
|
||||||
_telescopeController.SiteLongitude = 10;
|
_telescopeController.SiteLongitude = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void PulseGuideEast()
|
||||||
|
{
|
||||||
|
_isConnected = true;
|
||||||
|
|
||||||
|
_telescopeController.Connected = true;
|
||||||
|
|
||||||
|
_telescopeController.PulseGuide(GuideDirections.guideEast,100);
|
||||||
|
|
||||||
|
serialMock.Verify( x => x.Command(":Mge0100#"), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void PulseGuideWest()
|
||||||
|
{
|
||||||
|
_isConnected = true;
|
||||||
|
|
||||||
|
_telescopeController.Connected = true;
|
||||||
|
|
||||||
|
_telescopeController.PulseGuide(GuideDirections.guideWest, 1200);
|
||||||
|
|
||||||
|
serialMock.Verify(x => x.Command(":Mgw1200#"), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void PulseGuideNorth()
|
||||||
|
{
|
||||||
|
_isConnected = true;
|
||||||
|
|
||||||
|
_telescopeController.Connected = true;
|
||||||
|
|
||||||
|
_telescopeController.PulseGuide(GuideDirections.guideNorth, 256);
|
||||||
|
|
||||||
|
serialMock.Verify(x => x.Command(":Mgn0256#"), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void PulseGuideSouth()
|
||||||
|
{
|
||||||
|
_isConnected = true;
|
||||||
|
|
||||||
|
_telescopeController.Connected = true;
|
||||||
|
|
||||||
|
_telescopeController.PulseGuide(GuideDirections.guideSouth, 1024);
|
||||||
|
|
||||||
|
serialMock.Verify(x => x.Command(":Mgs1024#"), Times.Once);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ namespace ASCOM.MeadeAutostar497.Controller
|
|||||||
if (UserNewerPulseGuiding)
|
if (UserNewerPulseGuiding)
|
||||||
{
|
{
|
||||||
_serialPort.Command($":Mg{d}{duration:0000}#");
|
_serialPort.Command($":Mg{d}{duration:0000}#");
|
||||||
Thread.Sleep(duration);
|
Thread.Sleep(duration); //todo figure out if this is really needed
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user