Fixed the dataBits profile name, and upgraded the sharedresources unit tests for the new comport settings.
This commit is contained in:
@@ -123,10 +123,19 @@ namespace Meade.net.UnitTests
|
||||
|
||||
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
||||
profileWrapperMock.Verify( x => x.WriteValue(DriverId, "Trace Level", profileProperties.TraceLogger.ToString()), Times.Once);
|
||||
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "COM Port", profileProperties.ComPort), Times.Once);
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Speed", profileProperties.Speed.ToString()), Times.Once);
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Data Bits", profileProperties.DataBits.ToString()), Times.Once);
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Stop Bits", profileProperties.StopBits), Times.Once);
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Hand Shake", profileProperties.Handshake), Times.Once);
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Parity", profileProperties.Parity), Times.Once);
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Rts / Dtr", profileProperties.RtsDtrEnabled.ToString()), Times.Once);
|
||||
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Guide Rate Arc Seconds Per Second", profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture)), Times.Once);
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Precision", profileProperties.Precision), Times.Once);
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Guiding Style", profileProperties.GuidingStyle), Times.Once);
|
||||
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Backlash Compensation", profileProperties.BacklashCompensation.ToString(CultureInfo.CurrentCulture)), Times.Once);
|
||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Reverse Focuser Direction", profileProperties.ReverseFocusDirection.ToString()), Times.Once);
|
||||
}
|
||||
@@ -136,11 +145,20 @@ namespace Meade.net.UnitTests
|
||||
{
|
||||
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
|
||||
string ComPortDefault = "COM1";
|
||||
string TraceStateDefault = "false";
|
||||
|
||||
string ComPortDefault = "COM1";
|
||||
string SpeedDefault = "9600";
|
||||
string DataBitsDefault = "8";
|
||||
string StopBitsDefault = "One";
|
||||
string HandshakeDefault = "None";
|
||||
string ParityDefault = "None";
|
||||
string RtsDtrEnabledDefault = "false";
|
||||
|
||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||
string PrecisionDefault = "Unchanged";
|
||||
string GuidingStyleDefault = "Auto";
|
||||
|
||||
string BacklashCompensationDefault = "3000";
|
||||
string ReverseFocuserDiectionDefault = "true";
|
||||
|
||||
@@ -165,6 +183,24 @@ namespace Meade.net.UnitTests
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Reverse Focuser Direction", string.Empty, ReverseFocuserDiectionDefault))
|
||||
.Returns(() => ReverseFocuserDiectionDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
.Returns(() => SpeedDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||
.Returns(() => DataBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||
.Returns(() => StopBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||
.Returns(() => HandshakeDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||
.Returns(() => ParityDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
|
||||
.Returns(() => RtsDtrEnabledDefault);
|
||||
|
||||
IProfileWrapper profeWrapper = profileWrapperMock.Object;
|
||||
|
||||
@@ -176,14 +212,25 @@ namespace Meade.net.UnitTests
|
||||
var profileProperties = SharedResources.ReadProfile();
|
||||
|
||||
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
||||
|
||||
Assert.That(profileProperties.TraceLogger, Is.EqualTo(bool.Parse(TraceStateDefault)));
|
||||
|
||||
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
|
||||
|
||||
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
|
||||
Is.EqualTo(double.Parse(GuideRateProfileNameDefault)));
|
||||
Assert.That(profileProperties.TraceLogger, Is.EqualTo(bool.Parse(TraceStateDefault)));
|
||||
Assert.That(profileProperties.Precision, Is.EqualTo(PrecisionDefault));
|
||||
Assert.That(profileProperties.GuidingStyle, Is.EqualTo(GuidingStyleDefault));
|
||||
|
||||
Assert.That(profileProperties.BacklashCompensation, Is.EqualTo(int.Parse(BacklashCompensationDefault)));
|
||||
Assert.That(profileProperties.ReverseFocusDirection, Is.EqualTo(bool.Parse(ReverseFocuserDiectionDefault)));
|
||||
|
||||
Assert.That(profileProperties.Speed, Is.EqualTo(int.Parse(SpeedDefault)));
|
||||
Assert.That(profileProperties.DataBits, Is.EqualTo(int.Parse(DataBitsDefault)));
|
||||
Assert.That(profileProperties.StopBits, Is.EqualTo(StopBitsDefault));
|
||||
Assert.That(profileProperties.Handshake, Is.EqualTo(HandshakeDefault));
|
||||
Assert.That(profileProperties.Parity, Is.EqualTo(ParityDefault));
|
||||
Assert.That(profileProperties.RtsDtrEnabled, Is.EqualTo(bool.Parse(RtsDtrEnabledDefault)));
|
||||
}
|
||||
|
||||
[TestCase("TCP")]
|
||||
@@ -199,10 +246,16 @@ namespace Meade.net.UnitTests
|
||||
public void Connect_WhenDeviceIdIsSerialButGVPEchos_ThenThrowsException()
|
||||
{
|
||||
string deviceId = "Serial";
|
||||
|
||||
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
|
||||
string ComPortDefault = "COM1";
|
||||
string SpeedDefault = "9600";
|
||||
string DataBitsDefault = "8";
|
||||
string StopBitsDefault = "One";
|
||||
string HandshakeDefault = "None";
|
||||
string ParityDefault = "None";
|
||||
string RtsDtrEnabledDefault = "false";
|
||||
|
||||
string TraceStateDefault = "false";
|
||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||
string PrecisionDefault = "Unchanged";
|
||||
@@ -210,14 +263,33 @@ namespace Meade.net.UnitTests
|
||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||
profileWrapperMock.SetupAllProperties();
|
||||
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
.Returns(TraceStateDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
.Returns(ComPortDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
.Returns(() => SpeedDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||
.Returns(() => DataBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||
.Returns(() => StopBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||
.Returns(() => HandshakeDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||
.Returns(() => ParityDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
|
||||
.Returns(() => RtsDtrEnabledDefault);
|
||||
|
||||
profileWrapperMock
|
||||
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
.Returns(PrecisionDefault);
|
||||
|
||||
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||
@@ -239,26 +311,51 @@ namespace Meade.net.UnitTests
|
||||
public void Connect_WhenDeviceIdIsSerialButGVPNotSupported_ThenConnectsAndSetsProductToLX200Classic()
|
||||
{
|
||||
string deviceId = "Serial";
|
||||
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
|
||||
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
string TraceStateDefault = "false";
|
||||
|
||||
string ComPortDefault = "COM1";
|
||||
string TraceStateDefault = "false";
|
||||
string SpeedDefault = "9600";
|
||||
string DataBitsDefault = "8";
|
||||
string StopBitsDefault = "One";
|
||||
string HandshakeDefault = "None";
|
||||
string ParityDefault = "None";
|
||||
string RtsDtrEnabledDefault = "false";
|
||||
|
||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||
string PrecisionDefault = "Unchanged";
|
||||
|
||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||
profileWrapperMock.SetupAllProperties();
|
||||
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
.Returns(TraceStateDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
.Returns(ComPortDefault);
|
||||
profileWrapperMock
|
||||
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
.Returns(PrecisionDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
.Returns(() => SpeedDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||
.Returns(() => DataBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||
.Returns(() => StopBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||
.Returns(() => HandshakeDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||
.Returns(() => ParityDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
|
||||
.Returns(() => RtsDtrEnabledDefault);
|
||||
|
||||
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
||||
@@ -293,25 +390,51 @@ namespace Meade.net.UnitTests
|
||||
{
|
||||
string deviceId = "Serial";
|
||||
|
||||
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
|
||||
string TraceStateDefault = "false";
|
||||
|
||||
string ComPortDefault = "COM1";
|
||||
string TraceStateDefault = "false";
|
||||
string SpeedDefault = "9600";
|
||||
string DataBitsDefault = "8";
|
||||
string StopBitsDefault = "One";
|
||||
string HandshakeDefault = "None";
|
||||
string ParityDefault = "None";
|
||||
string RtsDtrEnabledDefault = "false";
|
||||
|
||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||
string PrecisionDefault = "Unchanged";
|
||||
|
||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||
profileWrapperMock.SetupAllProperties();
|
||||
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
.Returns(TraceStateDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
.Returns(ComPortDefault);
|
||||
profileWrapperMock
|
||||
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
.Returns(PrecisionDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
.Returns(() => SpeedDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||
.Returns(() => DataBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||
.Returns(() => StopBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||
.Returns(() => HandshakeDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||
.Returns(() => ParityDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
|
||||
.Returns(() => RtsDtrEnabledDefault);
|
||||
|
||||
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
||||
@@ -343,25 +466,51 @@ namespace Meade.net.UnitTests
|
||||
{
|
||||
string deviceId = "Serial";
|
||||
|
||||
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
|
||||
string TraceStateDefault = "false";
|
||||
|
||||
string ComPortDefault = "COM1";
|
||||
string TraceStateDefault = "false";
|
||||
string SpeedDefault = "9600";
|
||||
string DataBitsDefault = "8";
|
||||
string StopBitsDefault = "One";
|
||||
string HandshakeDefault = "None";
|
||||
string ParityDefault = "None";
|
||||
string RtsDtrEnabledDefault = "false";
|
||||
|
||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||
string PrecisionDefault = "Unchanged";
|
||||
|
||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||
profileWrapperMock.SetupAllProperties();
|
||||
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
.Returns(TraceStateDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
.Returns(ComPortDefault);
|
||||
profileWrapperMock
|
||||
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
.Returns(PrecisionDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
.Returns(() => SpeedDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||
.Returns(() => DataBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||
.Returns(() => StopBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||
.Returns(() => HandshakeDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||
.Returns(() => ParityDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
|
||||
.Returns(() => RtsDtrEnabledDefault);
|
||||
|
||||
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace ASCOM.Meade.net
|
||||
private const string SettleTimeName = "Settle Time";
|
||||
|
||||
private const string SpeedName = "Speed";
|
||||
private const string DataBitsName = "8";
|
||||
private const string DataBitsName = "Data Bits";
|
||||
private const string StopBitsName = "Stop Bits";
|
||||
private const string HandShakeName = "Hand Shake";
|
||||
private const string ParityName = "Parity";
|
||||
|
||||
Reference in New Issue
Block a user