Fixed some issued with the telescope parking and unparking. Now reports reported correctly for the LX200GPS, and Autostars

This commit is contained in:
2021-04-24 22:29:11 +01:00
parent f9bb2aa879
commit 7eec6c0008
4 changed files with 173 additions and 66 deletions
@@ -966,11 +966,52 @@ namespace Meade.net.Telescope.UnitTests
}
[Test]
public void CanUnpark_Get_ReturnsFalse()
public void CanUnpark_NotConnected_ThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() =>
{
var result = _telescope.CanUnpark;
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: CanUnpark"));
}
[TestCase(TelescopeList.LX200GPS, TelescopeList.LX200GPS_42G, true)]
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, false)]
public void CanUnpark_Get_ReturnsExpectedValue(string productVersion, string firmware, bool expectedResult)
{
ConnectTelescope(productVersion, firmware);
var result = _telescope.CanUnpark;
Assert.That(result, Is.True);
Assert.That(result, Is.EqualTo(expectedResult));
}
[Test]
public void Unpark_NotConnect_ThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() =>
{
_telescope.Unpark();
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: Unpark"));
}
[TestCase(TelescopeList.LX200GPS, TelescopeList.LX200GPS_42G, true)]
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, false)]
public void Unpark_ThenDoesNotThrowException(string productVersion, string firmware, bool canUnPark)
{
ConnectTelescope(productVersion, firmware);
if (canUnPark)
Assert.DoesNotThrow(() => { _telescope.Unpark(); });
else
{
var exception = Assert.Throws<ASCOM.InvalidOperationException>(() => { _telescope.Unpark(); });
Assert.That(exception.Message, Is.EqualTo("Unable to unpark this telescope type"));
}
}
[Test]
@@ -1702,12 +1743,6 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(result, Is.EqualTo(settleTime));
}
[Test]
public void Unpark_ThenDoesNotThrowException()
{
Assert.DoesNotThrow(() => { _telescope.Unpark(); });
}
[Test]
public void SiteLatitude_Get_WhenNotConnected_ThenThrowsException()
{
@@ -1732,7 +1767,7 @@ namespace Meade.net.Telescope.UnitTests
var result = _telescope.SiteLatitude;
_sharedResourcesWrapperMock.Verify( x => x.SendString(":Gt#", true), Times.Once);
_sharedResourcesWrapperMock.Verify( x => x.SendString(":Gt#", true), Times.AtLeastOnce);
Assert.That(result,Is.EqualTo(siteLatitudeValue));
}