diff --git a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs index e38f700..390d76c 100644 --- a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs +++ b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs @@ -2201,7 +2201,7 @@ namespace Meade.net.Telescope.UnitTests { var telescopeDecResult = "s12*34’56"; 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); diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index 70a27d5..8c3e88e 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -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