Added unit tests for the new Pulse guide implementation.

This commit is contained in:
2019-05-02 13:10:40 +01:00
parent d1b3f5718f
commit d2fae7607b
2 changed files with 50 additions and 3 deletions
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO.Ports;
using ASCOM;
using ASCOM.DeviceInterface;
using ASCOM.MeadeAutostar497.Controller;
using Moq;
using NUnit.Framework;
@@ -384,8 +385,6 @@ namespace MeadeAutostar497.UnitTests
Assert.That(exception.Message, Is.EqualTo("Failed to set site longitude."));
}
[Test]
public void SiteLongitude_Set_NoErrorWhenValidValueSentSuccessfully()
{
@@ -397,5 +396,53 @@ namespace MeadeAutostar497.UnitTests
_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)
{
_serialPort.Command($":Mg{d}{duration:0000}#");
Thread.Sleep(duration);
Thread.Sleep(duration); //todo figure out if this is really needed
}
else
{