Move SideOfPier, TargetRA/DEC properties to SharedResourcesWrapper

This change allows several instances of the driver to be in sync
w.r.t. TargetRightAscension, TargetDeclination and SideOfPier
This commit is contained in:
Sebastian Godelet
2021-06-12 15:47:34 +10:00
parent 8c4b08d0c6
commit 1684bd60bd
4 changed files with 122 additions and 80 deletions
@@ -100,10 +100,15 @@ namespace Meade.net.Telescope.UnitTests
SameDevice = 1
};
_sharedResourcesWrapperMock.Setup(x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>())).Returns( () => _connectionInfo );
_sharedResourcesWrapperMock.Setup(x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>())).Returns( () => _connectionInfo);
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(_profileProperties);
_sharedResourcesWrapperMock
.SetupProperty(x => x.SideOfPier)
.SetupProperty(x => x.TargetRightAscension)
.SetupProperty(x => x.TargetDeclination);
_astroMathsMock = new Mock<IAstroMaths>();
_clockMock = new Mock<IClock>();
@@ -1230,6 +1235,10 @@ namespace Meade.net.Telescope.UnitTests
public void DestinationSideOfPier_WhenHASiderealTimeDiffIsNotNull_ThenSideOfPierIsCalculated(double ra, double dec, double siderealTime, PierSide expectedDSOP)
{
// given
// deterministic start
_sharedResourcesWrapperMock.Object.SideOfPier = PierSide.pierUnknown;
// SideralTime uses ConditionRA to normalize to [0..24h), so we use it to mock the property
_astroUtilsMock.Setup(x => x.ConditionRA(It.IsAny<double>())).Returns(siderealTime);