diff --git a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs index 1c388a0..3c97754 100644 --- a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs +++ b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs @@ -163,7 +163,7 @@ namespace Meade.net.Telescope.UnitTests var exception = Assert.Throws(() => { _telescope.Action("site", site); }); - Assert.That(exception.Message, Is.EqualTo($"Site {site} not allowed must be between 1 and 4")); + Assert.That(exception.Message, Is.EqualTo($"Site {site} not allowed, must be between 1 and 4")); } [Test] @@ -618,13 +618,34 @@ namespace Meade.net.Telescope.UnitTests } [Test] - public void CanSetGuideRates_Get_ReturnsFalse() + public void CanSetGuideRates_Get_WhenNotConnected_ThenThrowsException() { + var exception = Assert.Throws(() => { var result = _telescope.CanSetGuideRates; }); + Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: CanSetGuideRates Get")); + } + + [Test] + public void CanSetGuideRates_Get_WhenConnectedToAutostar_ThenReturnsFalse() + { + ConnectTelescope(); + var result = _telescope.CanSetGuideRates; Assert.That(result, Is.False); } + [Test] + public void CanSetGuideRates_Get_WhenConnectedToLX200GPS_ThenReturnsTrue() + { + _sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.LX200GPS); + _sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.LX200GPS_42G); + _telescope.Connected = true; + + var result = _telescope.CanSetGuideRates; + + Assert.That(result, Is.True); + } + [Test] public void CanSetPark_Get_ReturnsFalse() { diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index 628c0cb..e78899c 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -253,7 +253,7 @@ namespace ASCOM.Meade.net break; default: LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); - throw new InvalidValueException($"Site {actionParameters} not allowed must be between 1 and 4"); + throw new InvalidValueException($"Site {actionParameters} not allowed, must be between 1 and 4"); } @@ -755,8 +755,12 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSetGuideRates", "Get - " + false.ToString()); - return false; + CheckConnected("CanSetGuideRates Get"); + + var canSetGuideRate = IsGuideRateSettingSupported(); + + LogMessage("CanSetGuideRates", "Get - " + canSetGuideRate.ToString()); + return canSetGuideRate; } }