Removed all # symbols from before the commands, as they're not really needed.
This commit is contained in:
@@ -43,7 +43,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(); });
|
||||
@@ -122,36 +122,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();
|
||||
@@ -172,7 +172,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")]
|
||||
@@ -187,10 +187,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)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(telescopeCommand)).Returns(siteName);
|
||||
@@ -227,10 +227,10 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(result, Is.EqualTo("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)
|
||||
{
|
||||
|
||||
@@ -369,8 +369,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,9 +385,9 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.Connected = true;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify( x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>()), 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]
|
||||
@@ -401,8 +401,8 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_telescope.Connected = true;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>()), 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -473,37 +473,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]
|
||||
@@ -545,7 +545,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]
|
||||
@@ -645,9 +645,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);
|
||||
@@ -815,7 +815,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)]
|
||||
@@ -827,7 +827,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;
|
||||
|
||||
@@ -843,7 +843,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)]
|
||||
@@ -859,7 +859,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]
|
||||
@@ -966,7 +966,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
public void Declination_Get_WhenConnected_ThenReadsValueFromScope(string declincationString)
|
||||
{
|
||||
var expectedResult = 12.34;
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GD#")).Returns(declincationString);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GD#")).Returns(declincationString);
|
||||
_utilMock.Setup(x => x.DMSToDegrees(declincationString)).Returns(expectedResult);
|
||||
|
||||
ConnectTelescope();
|
||||
@@ -981,14 +981,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var telescopeRaResult = "s12*34’56";
|
||||
var dmsResult = 1.2;
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GD#")).Returns(telescopeRaResult);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GD#")).Returns(telescopeRaResult);
|
||||
_utilMock.Setup(x => x.DMSToDegrees(telescopeRaResult)).Returns(dmsResult);
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
var result = _telescope.Declination;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:GD#"), Times.Exactly(2));
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GD#"), Times.Exactly(2));
|
||||
_utilMock.Verify(x => x.DMSToDegrees(telescopeRaResult), Times.Exactly(2));
|
||||
|
||||
Assert.That(result, Is.EqualTo(dmsResult));
|
||||
@@ -1102,7 +1102,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));
|
||||
}
|
||||
@@ -1135,7 +1135,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));
|
||||
}
|
||||
@@ -1157,23 +1157,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();
|
||||
@@ -1184,10 +1184,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)
|
||||
@@ -1196,14 +1196,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
switch (rate.Compare(0))
|
||||
{
|
||||
case ComparisonResult.Equals:
|
||||
_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);
|
||||
break;
|
||||
case ComparisonResult.Greater:
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Me#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Me#"), Times.Once);
|
||||
break;
|
||||
case ComparisonResult.Lower:
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Mw#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Mw#"), Times.Once);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -1211,14 +1211,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
switch (rate.Compare(0))
|
||||
{
|
||||
case ComparisonResult.Equals:
|
||||
_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);
|
||||
break;
|
||||
case ComparisonResult.Greater:
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Mn#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Mn#"), Times.Once);
|
||||
break;
|
||||
case ComparisonResult.Lower:
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Ms#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Ms#"), Times.Once);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -1264,11 +1264,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);
|
||||
}
|
||||
|
||||
@@ -1279,7 +1279,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);
|
||||
|
||||
|
||||
@@ -1287,7 +1287,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);
|
||||
}
|
||||
|
||||
@@ -1326,7 +1326,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);
|
||||
}
|
||||
|
||||
@@ -1336,7 +1336,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
[TestCase(GuideDirections.guideSouth)]
|
||||
public void PulseGuide_WhenSlewingAndPulseGuideAttempted_ThenThrowsExpectedException(GuideDirections direction)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("|");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns("|");
|
||||
|
||||
var duration = 0;
|
||||
ConnectTelescope();
|
||||
@@ -1352,7 +1352,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
[TestCase(GuideDirections.guideSouth, TelescopeAxes.axisSecondary)]
|
||||
public void PulseGuide_WhenMovingAxisAndPulseGuideAttempted_ThenThrowsExpectedException(GuideDirections direction, TelescopeAxes axes)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns("");
|
||||
|
||||
var duration = 0;
|
||||
ConnectTelescope();
|
||||
@@ -1417,10 +1417,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)]
|
||||
@@ -1453,10 +1453,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]
|
||||
@@ -1476,14 +1476,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var telescopeRaResult = "HH:MM:SS";
|
||||
var hmsResult = 1.2;
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GR#")).Returns(telescopeRaResult);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeRaResult);
|
||||
_utilMock.Setup(x => x.HMSToHours(telescopeRaResult)).Returns(hmsResult);
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
var result = _telescope.RightAscension;
|
||||
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:GR#"), Times.Exactly(2));
|
||||
_sharedResourcesWrapperMock.Verify( x => x.SendString(":GR#"), Times.Exactly(2));
|
||||
_utilMock.Verify( x => x.HMSToHours(telescopeRaResult), Times.Exactly(2));
|
||||
|
||||
Assert.That(result,Is.EqualTo(hmsResult));
|
||||
@@ -1605,14 +1605,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var siteLatitudeString = "testLatString";
|
||||
var siteLatitudeValue = 123.45;
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gt#")).Returns(siteLatitudeString);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gt#")).Returns(siteLatitudeString);
|
||||
_utilMock.Setup(x => x.DMSToDegrees(siteLatitudeString)).Returns(siteLatitudeValue);
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
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));
|
||||
}
|
||||
@@ -1655,8 +1655,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)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(expectedCommand)).Returns("1");
|
||||
@@ -1688,7 +1688,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
{
|
||||
var telescopeLongitude = "testLongitude";
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gg#")).Returns(telescopeLongitude);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gg#")).Returns(telescopeLongitude);
|
||||
_utilMock.Setup(x => x.DMSToDegrees(telescopeLongitude)).Returns(telescopeLongitudeValue);
|
||||
|
||||
ConnectTelescope();
|
||||
@@ -1735,7 +1735,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)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(expectedCommand)).Returns("1");
|
||||
@@ -1767,26 +1767,26 @@ namespace Meade.net.Telescope.UnitTests
|
||||
[Test]
|
||||
public void SyncToTarget_WhenSyncToTargetFails_ThenThrowsException()
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:CM#")).Returns(string.Empty);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":CM#")).Returns(string.Empty);
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
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]
|
||||
public void SyncToTarget_WhenSyncToTargetWorks_ThennoExceptionThrown()
|
||||
{
|
||||
_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'#");
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
Assert.DoesNotThrow(() => { _telescope.SyncToTarget(); });
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:CM#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(":CM#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1825,10 +1825,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)
|
||||
{
|
||||
|
||||
@@ -1855,7 +1855,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)
|
||||
{
|
||||
_utilMock.Setup(x => x.DegreesToDMS(declination, "*", ":", ":", 2)).Returns(decstring);
|
||||
@@ -1906,8 +1906,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)
|
||||
{
|
||||
_utilMock.Setup(x => x.HoursToHMS(rightAscension, ":", ":", ":", 2)).Returns(hms);
|
||||
@@ -1933,7 +1933,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)
|
||||
{
|
||||
_utilMock.Setup(x => x.HoursToHMS(rightAscension, ":", ":", ":", 2)).Returns(hms);
|
||||
@@ -1970,8 +1970,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();
|
||||
@@ -2039,9 +2039,9 @@ namespace Meade.net.Telescope.UnitTests
|
||||
public void UTCDate_Get_WhenConnected_ThenReturnsUTCDateTime(string telescopeDate, string telescopeTime,
|
||||
string telescopeUtcCorrection, int year, int month, int day, int hour, int min, int second)
|
||||
{
|
||||
_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);
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
@@ -2074,8 +2074,8 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
var newDate = new DateTime(year, month, day, hour, min, second, DateTimeKind.Local) + utcCorrection;
|
||||
|
||||
_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");
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
@@ -2093,9 +2093,9 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
var newDate = new DateTime(year, month, day, hour, min, second, DateTimeKind.Local) + utcCorrection;
|
||||
|
||||
_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");
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
@@ -2115,9 +2115,9 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
var newDate = new DateTime(year, month, day, hour, min, second, DateTimeKind.Local) + utcCorrection;
|
||||
|
||||
_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");
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
@@ -2136,16 +2136,16 @@ namespace Meade.net.Telescope.UnitTests
|
||||
string dec = "-30*30:00";
|
||||
|
||||
_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");
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
_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));
|
||||
}
|
||||
@@ -2157,7 +2157,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]
|
||||
@@ -2169,13 +2169,13 @@ 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]
|
||||
public void Slewing_WhenTelescopeIsSlewing_ThenReturnsTrue()
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("|");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns("|");
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
@@ -2183,7 +2183,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
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)]
|
||||
@@ -2199,7 +2199,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -2247,7 +2247,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
[Test]
|
||||
public void SlewToTargetAsync_WhenTargetSetAndSlewIsPossible_ThenAttemptsSlew()
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
@@ -2257,13 +2257,13 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
_telescope.SlewToTargetAsync();
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SlewToTargetAsync_WhenTargetBelowHorizon_ThenThrowsException()
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("1");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.ReadTerminated()).Returns("Below horizon");
|
||||
|
||||
ConnectTelescope();
|
||||
@@ -2278,7 +2278,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
[Test]
|
||||
public void SlewToTargetAsync_WhenTargetBelowElevation_ThenThrowsException()
|
||||
{
|
||||
_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");
|
||||
|
||||
ConnectTelescope();
|
||||
@@ -2293,7 +2293,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
[Test]
|
||||
public void SlewToTargetAsync_WhenTelescopeCanHitTripod_ThenThrowsException()
|
||||
{
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("3");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("3");
|
||||
_sharedResourcesWrapperMock.Setup(x => x.ReadTerminated()).Returns("the telescope can hit the tripod");
|
||||
|
||||
ConnectTelescope();
|
||||
@@ -2315,11 +2315,11 @@ namespace Meade.net.Telescope.UnitTests
|
||||
[Test]
|
||||
public void SlewToTarget_WhenSlewing_ThenWaitsForTheSlewToComplete()
|
||||
{
|
||||
_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)
|
||||
@@ -2350,11 +2350,11 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var rightAscension = 1;
|
||||
var declination = 2;
|
||||
|
||||
_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)
|
||||
@@ -2370,7 +2370,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]
|
||||
@@ -2386,11 +2386,11 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var rightAscension = 1;
|
||||
var declination = 2;
|
||||
|
||||
_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
|
||||
_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));
|
||||
}
|
||||
@@ -2459,15 +2459,15 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var rightAscension = 20;
|
||||
var declination = 10;
|
||||
|
||||
_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");
|
||||
|
||||
ConnectTelescope();
|
||||
|
||||
@@ -2475,7 +2475,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);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2493,19 +2493,19 @@ namespace Meade.net.Telescope.UnitTests
|
||||
var azimuth = 30;
|
||||
var altitude = 40;
|
||||
|
||||
_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)
|
||||
@@ -2519,7 +2519,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));
|
||||
}
|
||||
|
||||
@@ -2547,14 +2547,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
var mockHourAngle = 3;
|
||||
|
||||
_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);
|
||||
@@ -2592,14 +2592,14 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
var mockHourAngle = 3;
|
||||
|
||||
_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);
|
||||
@@ -2627,12 +2627,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