Added extra # in front of every command as recommended by Meade.
This commit is contained in:
@@ -42,7 +42,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_astroUtilsMock = new Mock<IAstroUtils>();
|
||||
|
||||
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MM’SS");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MM’SS");
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() =>_profileProperties);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Action>())).Callback<Action>(action => { action(); });
|
||||
@@ -117,36 +117,36 @@ namespace Meade.net.Telescope.UnitTests
|
||||
public void Action_Handbox_ReadDisplay()
|
||||
{
|
||||
string expectedResult = "test result string";
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":ED#")).Returns(expectedResult);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:ED#")).Returns(expectedResult);
|
||||
_telescope.Connected = true;
|
||||
|
||||
|
||||
|
||||
var actualResult = _telescope.Action("handbox", "readdisplay");
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":ED#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:ED#"), Times.Once);
|
||||
Assert.That(actualResult, Is.EqualTo(expectedResult));
|
||||
}
|
||||
|
||||
[TestCase("enter", ":EK13#")]
|
||||
[TestCase("mode", ":EK9#")]
|
||||
[TestCase("longMode", ":EK11#")]
|
||||
[TestCase("goto", ":EK24#")]
|
||||
[TestCase("0", ":EK48#")]
|
||||
[TestCase("1", ":EK49#")]
|
||||
[TestCase("2", ":EK50#")]
|
||||
[TestCase("3", ":EK51#")]
|
||||
[TestCase("4", ":EK52#")]
|
||||
[TestCase("5", ":EK53#")]
|
||||
[TestCase("6", ":EK54#")]
|
||||
[TestCase("7", ":EK55#")]
|
||||
[TestCase("8", ":EK56#")]
|
||||
[TestCase("9", ":EK57#")]
|
||||
[TestCase("up", ":EK94#")]
|
||||
[TestCase("down", ":EK118#")]
|
||||
[TestCase("back", ":EK87#")]
|
||||
[TestCase("forward", ":EK69#")]
|
||||
[TestCase("?", ":EK63#")]
|
||||
[TestCase("enter", "#:EK13#")]
|
||||
[TestCase("mode", "#:EK9#")]
|
||||
[TestCase("longMode", "#:EK11#")]
|
||||
[TestCase("goto", "#:EK24#")]
|
||||
[TestCase("0", "#:EK48#")]
|
||||
[TestCase("1", "#:EK49#")]
|
||||
[TestCase("2", "#:EK50#")]
|
||||
[TestCase("3", "#:EK51#")]
|
||||
[TestCase("4", "#:EK52#")]
|
||||
[TestCase("5", "#:EK53#")]
|
||||
[TestCase("6", "#:EK54#")]
|
||||
[TestCase("7", "#:EK55#")]
|
||||
[TestCase("8", "#:EK56#")]
|
||||
[TestCase("9", "#:EK57#")]
|
||||
[TestCase("up", "#:EK94#")]
|
||||
[TestCase("down", "#:EK118#")]
|
||||
[TestCase("back", "#:EK87#")]
|
||||
[TestCase("forward", "#:EK69#")]
|
||||
[TestCase("?", "#:EK63#")]
|
||||
public void Action_Handbox_WhenCalling_ThenSendsAppropriateBlindCommands(string action, string expectedString)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -167,7 +167,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
string parameters = $"select {site}";
|
||||
_telescope.Action("site", parameters);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":W{site}#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:W{site}#"), Times.Once);
|
||||
}
|
||||
|
||||
[TestCase("0")]
|
||||
@@ -182,10 +182,10 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo($"Site {parameters} not allowed, must be between 1 and 4"));
|
||||
}
|
||||
|
||||
[TestCase("1", ":GM#", "Home")]
|
||||
[TestCase("2", ":GN#", "Club")]
|
||||
[TestCase("3", ":GO#", "GPS")]
|
||||
[TestCase("4", ":GP#", "Parents")]
|
||||
[TestCase("1", "#:GM#", "Home")]
|
||||
[TestCase("2", "#:GN#", "Club")]
|
||||
[TestCase("3", "#:GO#", "GPS")]
|
||||
[TestCase("4", "#:GP#", "Parents")]
|
||||
public void Action_Site_GetName_WhenCallingWithValidValues_ThenSelectsCorrectSite(string site, string telescopeCommand, string siteName)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -211,10 +211,10 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo($"Site {parameters} not allowed, must be between 1 and 4"));
|
||||
}
|
||||
|
||||
[TestCase("1", ":SMHome#", "Home")]
|
||||
[TestCase("2", ":SNClub#", "Club")]
|
||||
[TestCase("3", ":SOGPS Site#", "GPS Site")]
|
||||
[TestCase("4", ":SPParents#", "Parents")]
|
||||
[TestCase("1", "#:SMHome#", "Home")]
|
||||
[TestCase("2", "#:SNClub#", "Club")]
|
||||
[TestCase("3", "#:SOGPS Site#", "GPS Site")]
|
||||
[TestCase("4", "#:SPParents#", "Parents")]
|
||||
public void Action_Site_SetName_WhenCallingWithValidValues_ThenSelectsCorrectSite(string site, string telescopeCommand, string siteName)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -352,8 +352,8 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
if (expectedConnected)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GZ#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:GZ#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,9 +368,9 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.Connected = true;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify( x => x.Connect("Serial", It.IsAny<string>()), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GZ#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:GZ#"), Times.Once);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"),Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"),Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -384,8 +384,8 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.Connected = true;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>()), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GZ#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:GZ#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
|
||||
}
|
||||
|
||||
|
||||
@@ -449,37 +449,37 @@ namespace Meade.net.Telescope.UnitTests
|
||||
[Test]
|
||||
public void SetLongFormatFalse_WhenTelescopeReturnsShortFormat_ThenDoesNothing()
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MM");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MM");
|
||||
_telescope.SetLongFormat(false);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":U#"),Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:U#"),Times.Never);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetLongFormatFalse_WhenTelescopeReturnsLongFormat_ThenTogglesPrecision()
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MM’SS");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MM’SS");
|
||||
_telescope.SetLongFormat(false);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":U#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:U#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetLongFormatTrue_WhenTelescopeReturnsLongFormat_ThenDoesNothing()
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MM’SS");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MM’SS");
|
||||
_telescope.SetLongFormat(true);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":U#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:U#"), Times.Never);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetLongFormatTrue_WhenTelescopeReturnsShortFormat_ThenTogglesPrecision()
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MM");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MM");
|
||||
_telescope.SetLongFormat(true);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":U#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:U#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -521,7 +521,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
_telescope.SelectSite(site);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":W{site}#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:W{site}#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -621,9 +621,9 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: AlignmentMode Set"));
|
||||
}
|
||||
|
||||
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algAltAz, ":AA#")]
|
||||
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algPolar, ":AP#")]
|
||||
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algGermanPolar, ":AP#")]
|
||||
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algAltAz, "#:AA#")]
|
||||
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algPolar, "#:AP#")]
|
||||
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algGermanPolar, "#:AP#")]
|
||||
public void AlignmentMode_Set_WhenConnected_ThenSendsExpectedCommand(string productName, string firmware, AlignmentModes alignmentMode, string expectedCommand)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
|
||||
@@ -791,7 +791,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
{
|
||||
_telescope.Connected = true;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString(":P#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:P#"), Times.Never);
|
||||
}
|
||||
|
||||
[TestCase("High", false, true)]
|
||||
@@ -803,7 +803,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_profileProperties.Precision = desiredPresision;
|
||||
var currentPrecision = telescopePrecision;
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":P#")).Returns(() =>
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:P#")).Returns(() =>
|
||||
{
|
||||
currentPrecision = !currentPrecision;
|
||||
|
||||
@@ -819,7 +819,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.Connected = true;
|
||||
|
||||
Assert.That(currentPrecision, Is.EqualTo(finalPrecision));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":P#"), Times.AtLeastOnce);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:P#"), Times.AtLeastOnce);
|
||||
}
|
||||
|
||||
[TestCase("High", false, true)]
|
||||
@@ -835,7 +835,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
_telescope.Connected = true;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":P#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:P#"), Times.Never);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -944,7 +944,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var expectedResult = 12.34;
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GD#")).Returns(declincationString);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GD#")).Returns(declincationString);
|
||||
_utilMock.Setup(x => x.DMSToDegrees(declincationString)).Returns(expectedResult);
|
||||
|
||||
var actualResult = _telescope.Declination;
|
||||
@@ -1059,7 +1059,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
_telescope.GuideRateDeclination = newGuideRate;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Rg01.2#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Rg01.2#"), Times.Once);
|
||||
|
||||
Assert.That(_telescope.GuideRateDeclination, Is.EqualTo(newGuideRate));
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
_telescope.GuideRateRightAscension = newGuideRate;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Rg01.2#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Rg01.2#"), Times.Once);
|
||||
|
||||
Assert.That(_telescope.GuideRateDeclination, Is.EqualTo(newGuideRate));
|
||||
}
|
||||
@@ -1114,23 +1114,23 @@ namespace Meade.net.Telescope.UnitTests
|
||||
}
|
||||
|
||||
[TestCase( 0, "", TelescopeAxes.axisPrimary)]
|
||||
[TestCase( 1, ":RG#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase(-1, ":RG#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase( 2, ":RC#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase(-2, ":RC#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase( 3, ":RM#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase(-3, ":RM#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase( 4, ":RS#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase(-4, ":RS#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase( 1, "#:RG#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase(-1, "#:RG#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase( 2, "#:RC#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase(-2, "#:RC#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase( 3, "#:RM#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase(-3, "#:RM#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase( 4, "#:RS#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase(-4, "#:RS#", TelescopeAxes.axisPrimary)]
|
||||
[TestCase(0, "", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(1, ":RG#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(-1, ":RG#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(2, ":RC#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(-2, ":RC#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(3, ":RM#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(-3, ":RM#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(4, ":RS#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(-4, ":RS#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(1, "#:RG#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(-1, "#:RG#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(2, "#:RC#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(-2, "#:RC#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(3, "#:RM#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(-3, "#:RM#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(4, "#:RS#", TelescopeAxes.axisSecondary)]
|
||||
[TestCase(-4, "#:RS#", TelescopeAxes.axisSecondary)]
|
||||
public void MoveAxis_WhenConnected_ThenExecutesCorrectCommandSequence(double rate, string slewRateCommand, TelescopeAxes axis)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -1141,10 +1141,10 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(slewRateCommand), Times.Once);
|
||||
else
|
||||
{
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RG#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RC#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RM#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RS#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RG#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RC#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RM#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RS#"), Times.Never);
|
||||
}
|
||||
|
||||
switch (axis)
|
||||
@@ -1152,31 +1152,31 @@ namespace Meade.net.Telescope.UnitTests
|
||||
case TelescopeAxes.axisPrimary:
|
||||
if (rate == 0)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Qe#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Qw#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Qe#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Qw#"), Times.Once);
|
||||
}
|
||||
else if (rate > 0)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Me#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Me#"), Times.Once);
|
||||
}
|
||||
else
|
||||
{
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Mw#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Mw#"), Times.Once);
|
||||
}
|
||||
break;
|
||||
case TelescopeAxes.axisSecondary:
|
||||
if (rate == 0)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Qn#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Qs#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Qn#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Qs#"), Times.Once);
|
||||
}
|
||||
else if (rate > 0)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Mn#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Mn#"), Times.Once);
|
||||
}
|
||||
else
|
||||
{
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Ms#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Ms#"), Times.Once);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1221,11 +1221,11 @@ namespace Meade.net.Telescope.UnitTests
|
||||
{
|
||||
ConnectTelescope();
|
||||
Assert.That(_telescope.AtPark, Is.False);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":hP#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:hP#"), Times.Never);
|
||||
|
||||
_telescope.Park();
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":hP#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:hP#"), Times.Once);
|
||||
Assert.That(_telescope.AtPark, Is.True);
|
||||
}
|
||||
|
||||
@@ -1236,7 +1236,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
_telescope.Park();
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":hP#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:hP#"), Times.Once);
|
||||
Assert.That(_telescope.AtPark, Is.True);
|
||||
|
||||
|
||||
@@ -1244,7 +1244,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.Park();
|
||||
|
||||
//no change from previous state.
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":hP#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:hP#"), Times.Once);
|
||||
Assert.That(_telescope.AtPark, Is.True);
|
||||
}
|
||||
|
||||
@@ -1283,7 +1283,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
break;
|
||||
}
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Mg{d}{duration:0000}#"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Mg{d}{duration:0000}#"));
|
||||
_utilMock.Verify( x => x.WaitForMilliseconds(duration), Times.Once);
|
||||
}
|
||||
|
||||
@@ -1317,10 +1317,10 @@ namespace Meade.net.Telescope.UnitTests
|
||||
break;
|
||||
}
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RG#"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":M{d}#"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RG#"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:M{d}#"));
|
||||
_utilMock.Verify(x => x.WaitForMilliseconds(duration), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Q{d}#"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Q{d}#"));
|
||||
}
|
||||
|
||||
[TestCase(GuideDirections.guideEast)]
|
||||
@@ -1353,10 +1353,10 @@ namespace Meade.net.Telescope.UnitTests
|
||||
break;
|
||||
}
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RG#"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":M{d}#"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RG#"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:M{d}#"));
|
||||
_utilMock.Verify(x => x.WaitForMilliseconds(duration), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Q{d}#"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Q{d}#"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1378,12 +1378,12 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeRaResult);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GR#")).Returns(telescopeRaResult);
|
||||
_utilMock.Setup(x => x.HMSToHours(telescopeRaResult)).Returns(hmsResult);
|
||||
|
||||
var result = _telescope.RightAscension;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString(":GR#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:GR#"), Times.Once);
|
||||
_utilMock.Verify( x => x.HMSToHours(telescopeRaResult), Times.Once);
|
||||
|
||||
Assert.That(result,Is.EqualTo(hmsResult));
|
||||
@@ -1506,12 +1506,12 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var siteLatitudeValue = 123.45;
|
||||
|
||||
ConnectTelescope();
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gt#")).Returns(siteLatitudeString);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gt#")).Returns(siteLatitudeString);
|
||||
_utilMock.Setup(x => x.DMSToDegrees(siteLatitudeString)).Returns(siteLatitudeValue);
|
||||
|
||||
var result = _telescope.SiteLatitude;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString(":Gt#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:Gt#"), Times.Once);
|
||||
|
||||
Assert.That(result,Is.EqualTo(siteLatitudeValue));
|
||||
}
|
||||
@@ -1554,8 +1554,8 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo("Failed to set site latitude."));
|
||||
}
|
||||
|
||||
[TestCase(-10.5, ":St-10*30#")]
|
||||
[TestCase(20.75, ":St+20*45#")]
|
||||
[TestCase(-10.5, "#:St-10*30#")]
|
||||
[TestCase(20.75, "#:St+20*45#")]
|
||||
public void SiteLatitude_Set_WhenValidValues_ThenValueSentToTelescope(double siteLatitude, string expectedCommand)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -1590,7 +1590,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gg#")).Returns(telescopeLongitude);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gg#")).Returns(telescopeLongitude);
|
||||
_utilMock.Setup(x => x.DMSToDegrees(telescopeLongitude)).Returns(telescopeLongitudeValue);
|
||||
|
||||
var result = _telescope.SiteLongitude;
|
||||
@@ -1634,7 +1634,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo("Failed to set site longitude."));
|
||||
}
|
||||
|
||||
[TestCase(10, ":Sg350*00#")]
|
||||
[TestCase(10, "#:Sg350*00#")]
|
||||
public void SiteLongitude_Set_WhenConnectedAndTelescopeFails_ThenThrowsException(double longitude, string expectedCommand)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -1668,12 +1668,12 @@ namespace Meade.net.Telescope.UnitTests
|
||||
{
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":CM#")).Returns(string.Empty);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:CM#")).Returns(string.Empty);
|
||||
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => { _telescope.SyncToTarget(); } );
|
||||
|
||||
Assert.That(exception.Message, Is.EqualTo("Unable to perform sync"));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":CM#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:CM#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1681,11 +1681,11 @@ namespace Meade.net.Telescope.UnitTests
|
||||
{
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":CM#")).Returns(" M31 EX GAL MAG 3.5 SZ178.0'#");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:CM#")).Returns(" M31 EX GAL MAG 3.5 SZ178.0'#");
|
||||
|
||||
Assert.DoesNotThrow(() => { _telescope.SyncToTarget(); });
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":CM#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:CM#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1724,10 +1724,10 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo("Target declination invalid"));
|
||||
}
|
||||
|
||||
[TestCase(-30.5, "-30*30:00", ":Sd-30*30:00#")]
|
||||
[TestCase(30.5, "30*30:00", ":Sd+30*30:00#")]
|
||||
[TestCase(-75.25, "-75*15:00", ":Sd-75*15:00#")]
|
||||
[TestCase(50, "50*00:00", ":Sd+50*00:00#")]
|
||||
[TestCase(-30.5, "-30*30:00", "#:Sd-30*30:00#")]
|
||||
[TestCase(30.5, "30*30:00", "#:Sd+30*30:00#")]
|
||||
[TestCase(-75.25, "-75*15:00", "#:Sd-75*15:00#")]
|
||||
[TestCase(50, "50*00:00", "#:Sd+50*00:00#")]
|
||||
public void TargetDeclination_Set_WhenValueOK_ThenSetsNewTargetDeclination( double declination,string decstring, string commandString)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -1753,7 +1753,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo("Target not set"));
|
||||
}
|
||||
|
||||
[TestCase(50, "50*00:00", ":Sd+50*00:00#")]
|
||||
[TestCase(50, "50*00:00", "#:Sd+50*00:00#")]
|
||||
public void TargetDeclination_Get_WhenValueOK_ThenSetsNewTargetDeclination(double declination, string decstring, string commandString)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -1804,8 +1804,8 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo("Failed to set TargetRightAscension."));
|
||||
}
|
||||
|
||||
[TestCase(5.5, "05:30:00", ":Sr05:30:00#")]
|
||||
[TestCase(10, "10:00:00", ":Sr10:00:00#")]
|
||||
[TestCase(5.5, "05:30:00", "#:Sr05:30:00#")]
|
||||
[TestCase(10, "10:00:00", "#:Sr10:00:00#")]
|
||||
public void TargetRightAscension_Set_WhenValueOK_ThenSetsNewTargetDeclination(double rightAscension, string hms, string commandString)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -1831,7 +1831,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo("Target not set"));
|
||||
}
|
||||
|
||||
[TestCase(15, "15:00:00", ":Sr15:00:00#")]
|
||||
[TestCase(15, "15:00:00", "#:Sr15:00:00#")]
|
||||
public void TargetRightAscension_Get_WhenValueOK_ThenSetsNewTargetDeclination(double rightAscension, string hms, string commandString)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -1868,8 +1868,8 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: TrackingRate Set"));
|
||||
}
|
||||
|
||||
[TestCase(DriveRates.driveSidereal, ":TQ#")]
|
||||
[TestCase(DriveRates.driveLunar, ":TL#")]
|
||||
[TestCase(DriveRates.driveSidereal, "#:TQ#")]
|
||||
[TestCase(DriveRates.driveLunar, "#:TL#")]
|
||||
public void TrackingRate_Set_WhenConnected_ThenSendsCommandToTelescope(DriveRates rate, string commandString)
|
||||
{
|
||||
ConnectTelescope();
|
||||
@@ -1939,9 +1939,9 @@ namespace Meade.net.Telescope.UnitTests
|
||||
{
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns(telescopeDate);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns(telescopeTime);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns(telescopeUtcCorrection);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns(telescopeDate);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns(telescopeTime);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns(telescopeUtcCorrection);
|
||||
|
||||
var result = _telescope.UTCDate;
|
||||
|
||||
@@ -1974,8 +1974,8 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns(telescopeUtcCorrection);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SL{telescopeTime}#")).Returns("0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns(telescopeUtcCorrection);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SL{telescopeTime}#")).Returns("0");
|
||||
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => { _telescope.UTCDate = newDate; } );
|
||||
|
||||
@@ -1993,9 +1993,9 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns(telescopeUtcCorrection);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SL{telescopeTime}#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SC{newDate:MM/dd/yy}#")).Returns("0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns(telescopeUtcCorrection);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SL{telescopeTime}#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SC{newDate:MM/dd/yy}#")).Returns("0");
|
||||
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => { _telescope.UTCDate = newDate; });
|
||||
|
||||
@@ -2015,9 +2015,9 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns(telescopeUtcCorrection);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SL{telescopeTime}#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SC{telescopeDate}#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns(telescopeUtcCorrection);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SL{telescopeTime}#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SC{telescopeDate}#")).Returns("1");
|
||||
|
||||
_telescope.UTCDate = newDate;
|
||||
|
||||
@@ -2036,14 +2036,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
ConnectTelescope();
|
||||
|
||||
_utilMock.Setup(x => x.HoursToHMS(rightAscension, ":", ":", ":", 2)).Returns(hms);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":Sr{hms}#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:Sr{hms}#")).Returns("1");
|
||||
|
||||
_utilMock.Setup(x => x.DegreesToDMS(declination, "*", ":", ":", 2)).Returns(dec);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":Sd{dec}#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:Sd{dec}#")).Returns("1");
|
||||
|
||||
_telescope.SyncToCoordinates(rightAscension, declination);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString(":CM#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:CM#"), Times.Once);
|
||||
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
|
||||
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
|
||||
}
|
||||
@@ -2055,7 +2055,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
Assert.That(result, Is.False);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:D#"), Times.Never);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2067,7 +2067,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
Assert.That(result, Is.False);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:D#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2075,13 +2075,13 @@ namespace Meade.net.Telescope.UnitTests
|
||||
{
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns("|");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("|");
|
||||
|
||||
var result = _telescope.Slewing;
|
||||
|
||||
Assert.That(result, Is.True);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"),Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:D#"),Times.Once);
|
||||
}
|
||||
|
||||
[TestCase(1, TelescopeAxes.axisPrimary)]
|
||||
@@ -2097,7 +2097,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var result = _telescope.Slewing;
|
||||
|
||||
Assert.That(result, Is.True);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"), Times.Never);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:D#"), Times.Never);
|
||||
}
|
||||
|
||||
|
||||
@@ -2150,11 +2150,11 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.TargetRightAscension = 2;
|
||||
_telescope.TargetDeclination = 1;
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
|
||||
|
||||
_telescope.SlewToTargetAsync();
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2165,7 +2165,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.TargetRightAscension = 2;
|
||||
_telescope.TargetDeclination = 1;
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("1");
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.ReadTerminated()).Returns("Below horizon");
|
||||
|
||||
@@ -2181,7 +2181,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.TargetRightAscension = 2;
|
||||
_telescope.TargetDeclination = 1;
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("2");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("2");
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.ReadTerminated()).Returns("Above below elevation");
|
||||
|
||||
@@ -2204,11 +2204,11 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.TargetRightAscension = 2;
|
||||
_telescope.TargetDeclination = 1;
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
|
||||
|
||||
var slewCounter = 0;
|
||||
var iterations = 10;
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns(() =>
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns(() =>
|
||||
{
|
||||
slewCounter++;
|
||||
if (slewCounter <= iterations)
|
||||
@@ -2236,11 +2236,11 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
|
||||
|
||||
//var slewCounter = 0;
|
||||
//var iterations = 10;
|
||||
//_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns(() =>
|
||||
//_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns(() =>
|
||||
//{
|
||||
// slewCounter++;
|
||||
// if (slewCounter <= iterations)
|
||||
@@ -2254,7 +2254,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
//_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations));
|
||||
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
|
||||
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendChar(":MS#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendChar("#:MS#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2272,11 +2272,11 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
|
||||
|
||||
var slewCounter = 0;
|
||||
var iterations = 10;
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns(() =>
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns(() =>
|
||||
{
|
||||
slewCounter++;
|
||||
if (slewCounter <= iterations)
|
||||
@@ -2287,7 +2287,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.SlewToCoordinates(rightAscension, declination);
|
||||
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
|
||||
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
|
||||
|
||||
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations));
|
||||
}
|
||||
@@ -2345,21 +2345,21 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns("10/15/20");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns("20:15:10");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns("-1.0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns("10/15/20");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns("20:15:10");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns("-1.0");
|
||||
|
||||
_astroMathsMock
|
||||
.Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(),
|
||||
It.IsAny<HorizonCoordinates>())).Returns(new EquatorialCoordinates { Declination = declination, RightAscension = rightAscension });
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
|
||||
|
||||
_telescope.SlewToAltAzAsync(azimuth, altitude);
|
||||
|
||||
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
|
||||
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2379,19 +2379,19 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns("10/15/20");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns("20:15:10");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns("-1.0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns("10/15/20");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns("20:15:10");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns("-1.0");
|
||||
|
||||
_astroMathsMock
|
||||
.Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(),
|
||||
It.IsAny<HorizonCoordinates>())).Returns(new EquatorialCoordinates { Declination = declination, RightAscension = rightAscension });
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
|
||||
|
||||
var slewCounter = 0;
|
||||
var iterations = 10;
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns(() =>
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns(() =>
|
||||
{
|
||||
slewCounter++;
|
||||
if (slewCounter <= iterations)
|
||||
@@ -2403,7 +2403,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
|
||||
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
|
||||
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations));
|
||||
}
|
||||
|
||||
@@ -2433,14 +2433,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns("10/15/20");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns("20:15:10");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns("-1.0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns("10/15/20");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns("20:15:10");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns("-1.0");
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gg#")).Returns(telescopeLongitude);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gg#")).Returns(telescopeLongitude);
|
||||
_utilMock.Setup(x => x.DMSToDegrees(telescopeLongitude)).Returns(telescopeLongitudeValue);
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeLatitude);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GR#")).Returns(telescopeLatitude);
|
||||
_utilMock.Setup(x => x.HMSToHours(telescopeLatitude)).Returns(telescopeLatitudeValue);
|
||||
|
||||
_astroMathsMock.Setup(x => x.RightAscensionToHourAngle(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>())).Returns(mockHourAngle);
|
||||
@@ -2478,14 +2478,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns("10/15/20");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns("20:15:10");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns("-1.0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns("10/15/20");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns("20:15:10");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns("-1.0");
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gg#")).Returns(telescopeLongitude);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gg#")).Returns(telescopeLongitude);
|
||||
_utilMock.Setup(x => x.DMSToDegrees(telescopeLongitude)).Returns(telescopeLongitudeValue);
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeLatitude);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GR#")).Returns(telescopeLatitude);
|
||||
_utilMock.Setup(x => x.HMSToHours(telescopeLatitude)).Returns(telescopeLatitudeValue);
|
||||
|
||||
_astroMathsMock.Setup(x => x.RightAscensionToHourAngle(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>())).Returns(mockHourAngle);
|
||||
@@ -2511,12 +2511,12 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
_telescope.AbortSlew();
|
||||
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":Q#"),Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendBlind("#:Q#"),Times.Once);
|
||||
|
||||
var isSloSlewing = _telescope.Slewing;
|
||||
|
||||
Assert.That(isSloSlewing, Is.False);
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString(":D#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:D#"), Times.Once);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user