Fixed logic for LX200 Classic is slewing test
This commit is contained in:
@@ -67,10 +67,10 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_sharedResourcesWrapperMock.Object, _astroMathsMock.Object);
|
||||
}
|
||||
|
||||
private void ConnectTelescope()
|
||||
private void ConnectTelescope(string productName = TelescopeList.Autostar497, string firmwareVersion = TelescopeList.Autostar497_31Ee)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => productName);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => firmwareVersion);
|
||||
_telescope.Connected = true;
|
||||
}
|
||||
|
||||
@@ -2184,6 +2184,25 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"),Times.Once);
|
||||
}
|
||||
|
||||
[TestCase(TelescopeList.LX200CLASSIC,"","|", true)]
|
||||
[TestCase(TelescopeList.LX200CLASSIC, "", "||||||||", true)]
|
||||
[TestCase(TelescopeList.LX200CLASSIC, "", "", false)]
|
||||
[TestCase(TelescopeList.LX200CLASSIC, "", "[FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF] [FF][FF][FF][FF][FF][FF]", false)]
|
||||
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "|", true)]
|
||||
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "", false)]
|
||||
public void Slewing_WhenTelescopeNotSlewing_ThenReturnsFalse(string productName, string firmwareVersion, string response, bool isSlewing)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns(response);
|
||||
|
||||
ConnectTelescope(productName, firmwareVersion);
|
||||
|
||||
var result = _telescope.Slewing;
|
||||
|
||||
Assert.That(result, Is.EqualTo(isSlewing));
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"), Times.Once);
|
||||
}
|
||||
|
||||
[TestCase(1, TelescopeAxes.axisPrimary)]
|
||||
[TestCase(-1, TelescopeAxes.axisPrimary)]
|
||||
[TestCase(1, TelescopeAxes.axisSecondary)]
|
||||
|
||||
@@ -1883,9 +1883,9 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
|
||||
var trimmedResult = result.Trim();
|
||||
var isResultEmpty = trimmedResult != string.Empty;
|
||||
var isResultEmpty = trimmedResult == string.Empty;
|
||||
|
||||
var isSlewing = isResultEmpty;
|
||||
var isSlewing = !isResultEmpty;
|
||||
|
||||
if (!isResultEmpty) //the LX-200 can return crap from the buffer when it's not slewing so let's try to filter that out.
|
||||
{
|
||||
|
||||
@@ -4,30 +4,30 @@
|
||||
{
|
||||
#region Autostar 497/Audiostar
|
||||
|
||||
public static readonly string Autostar497 = "Autostar";
|
||||
public const string Autostar497 = "Autostar";
|
||||
|
||||
//Autostar/Audiostar firmware revisions
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static readonly string Autostar497_30Ee = "30Ee";
|
||||
public const string Autostar497_30Ee = "30Ee";
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static readonly string Autostar497_31Ee = "31Ee";
|
||||
public const string Autostar497_31Ee = "31Ee";
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static readonly string Autostar497_43Eg = "43Eg";
|
||||
public const string Autostar497_43Eg = "43Eg";
|
||||
|
||||
#endregion
|
||||
|
||||
#region LX200GPS
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static readonly string LX200GPS = "LX2001";
|
||||
public const string LX200GPS = "LX2001";
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static readonly string LX200GPS_42G = "4.2G";
|
||||
public const string LX200GPS_42G = "4.2G";
|
||||
#endregion
|
||||
|
||||
#region LX200EMC
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static readonly string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
|
||||
public const string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user