Fixed logic for LX200 Classic is slewing test

This commit is contained in:
2020-09-24 22:01:52 +01:00
parent c34ed41ddf
commit 1b73bb62b6
3 changed files with 31 additions and 12 deletions
@@ -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)]