Fixed SyncToCoordinates_WhenConnected_ThenReturnsExpectedResult

This commit is contained in:
2021-01-30 21:45:47 +00:00
parent 447ff3ace9
commit 778b36b7f5
2 changed files with 20 additions and 8 deletions
@@ -2201,7 +2201,7 @@ namespace Meade.net.Telescope.UnitTests
{
var telescopeDecResult = "s12*3456";
var telescopeRaResult = "HH:MM:SS";
var hmsResult = 1.2;
//var hmsResult = 1.2;
double rightAscension = 5.5;
string hms = "05:30:00";
@@ -2209,18 +2209,30 @@ namespace Meade.net.Telescope.UnitTests
double declination = -30.5;
string dec = "-30*30:00";
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GD#")).Returns(telescopeDecResult);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeRaResult);
var digitsRA = 2;
_utilMock.Setup(x => x.HMSToHours(telescopeRaResult)).Returns(hmsResult);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":Sr{telescopeRaResult}#")).Returns("1");
_utilMock.Setup(x => x.HoursToHMS(rightAscension, ":", ":", ":", digitsRA)).Returns(telescopeRaResult);
_utilMock.Setup(x => x.HMSToHours(hms)).Returns(rightAscension);
_utilMock.Setup(x => x.DegreesToDMS(declination, "*", ":", ":", digitsRA)).Returns(telescopeDecResult);
_utilMock.Setup(x => x.DMSToDegrees(telescopeDecResult)).Returns(declination);
//_utilMock.Setup(x => x.HMSToHours(telescopeRaResult)).Returns(hmsResult);
_utilMock.Setup(x => x.DMSToDegrees(dec)).Returns(declination);
_utilMock.Setup(x => x.HoursToHMS(rightAscension, ":", ":", ":", 2)).Returns(hms);
_utilMock.Setup(x => x.DegreesToDMS(declination, "*", ":", ":", digitsRA)).Returns(dec);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":Sr{hms}#")).Returns("1");
_utilMock.Setup(x => x.DegreesToDMS(declination, "*", ":", ":", 2)).Returns(dec);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":Sd{dec}#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendString($":CM#")).Returns("M31 EX GAL MAG 3.5 SZ178.0'#");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GD#")).Returns(telescopeDecResult);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeRaResult);
_utilMock.Setup(x => x.HMSToHours(telescopeRaResult)).Returns(rightAscension);
ConnectTelescope();
_telescope.SyncToCoordinates(rightAscension, declination);
@@ -2501,10 +2513,10 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeRaResult);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":Sr{telescopeRaResult}#")).Returns("1");
_utilMock.Setup(x => x.DMSToDegrees(telescopeDecResult)).Returns(dmsResult);
_utilMock.Setup(x => x.HMSToHours(telescopeRaResult)).Returns(hmsResult);
_utilMock.Setup(x => x.HoursToHMS(rightAscension, ":", ":", ":", digitsRA)).Returns(telescopeRaResult);
_utilMock.Setup(x => x.HMSToHours(telescopeRaResult)).Returns(rightAscension);
_utilMock.Setup(x => x.DMSToDegrees(telescopeDecResult)).Returns(dmsResult);
_utilMock.Setup(x => x.DegreesToDMS(declination, "*", ":", ":", digitsRA)).Returns(telescopeDecResult);
+1 -1
View File
@@ -2045,7 +2045,7 @@ namespace ASCOM.Meade.net
//LX200's - a "#" terminated string with the name of the object that was synced.
// Autostars & Autostar II - A static string: " M31 EX GAL MAG 3.5 SZ178.0'#"
if (result == string.Empty)
if (string.IsNullOrWhiteSpace(result))
throw new InvalidOperationException("Unable to perform sync");
// At least the classic LX200 low precision might not slew to the exact target position