From 2c7de157e8ee6bfb781f02c38d4dd7c0aea84eaf Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 24 May 2020 16:40:47 +0100 Subject: [PATCH] Added unit test for telescope hitting tripod. --- .../TelescopeUnitTests.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs index 7d5f056..e2e7796 100644 --- a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs +++ b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs @@ -2291,6 +2291,21 @@ namespace Meade.net.Telescope.UnitTests Assert.That(exception.Message, Is.EqualTo("Above below elevation")); } + [Test] + public void SlewToTargetAsync_WhenTelescopeCanHitTripod_ThenThrowsException() + { + _sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("3"); + _sharedResourcesWrapperMock.Setup(x => x.ReadTerminated()).Returns("the telescope can hit the tripod"); + + ConnectTelescope(); + + _telescope.TargetRightAscension = 2; + _telescope.TargetDeclination = 1; + + var exception = Assert.Throws(() => { _telescope.SlewToTargetAsync(); }); + Assert.That(exception.Message, Is.EqualTo("the telescope can hit the tripod")); + } + [Test] public void SlewToTarget_WhenNotConnected_ThenThrowsException() {