Fixed unit tests
This commit is contained in:
@@ -151,21 +151,21 @@ namespace Meade.net.UnitTests
|
|||||||
string TraceStateDefault = "false";
|
string TraceStateDefault = "false";
|
||||||
|
|
||||||
string ComPortDefault = "COM1";
|
string ComPortDefault = "COM1";
|
||||||
string SpeedDefault = "9600";
|
int SpeedDefault = 9600;
|
||||||
string DataBitsDefault = "8";
|
int DataBitsDefault = 8;
|
||||||
string StopBitsDefault = "One";
|
string StopBitsDefault = "One";
|
||||||
string HandshakeDefault = "None";
|
string HandshakeDefault = "None";
|
||||||
string ParityDefault = "None";
|
string ParityDefault = "None";
|
||||||
string RtsDtrEnabledDefault = "true";
|
bool RtsDtrEnabledDefault = true;
|
||||||
|
|
||||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
double GuideRateProfileNameDefault = 10.077939; //67% of sidereal rate
|
||||||
string PrecisionDefault = "Unchanged";
|
string PrecisionDefault = "Unchanged";
|
||||||
string GuidingStyleDefault = "Auto";
|
string GuidingStyleDefault = "Auto";
|
||||||
|
|
||||||
string BacklashCompensationDefault = "3000";
|
int BacklashCompensationDefault = 3000;
|
||||||
string ReverseFocuserDiectionDefault = "true";
|
bool ReverseFocuserDiectionDefault = true;
|
||||||
|
|
||||||
string SendDateTimeDefault = "true";
|
bool SendDateTimeDefault = true;
|
||||||
string SkipPromptsDefault = "true";
|
string SkipPromptsDefault = "true";
|
||||||
|
|
||||||
string ParkedBehaviourDefault = "No Coordinates";
|
string ParkedBehaviourDefault = "No Coordinates";
|
||||||
@@ -184,23 +184,23 @@ namespace Meade.net.UnitTests
|
|||||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||||
.Returns(ComPortDefault);
|
.Returns(ComPortDefault);
|
||||||
profileWrapperMock
|
profileWrapperMock
|
||||||
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
.Setup(x => x.GetValueDouble(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
GuideRateProfileNameDefault.ToString())).Returns(GuideRateProfileNameDefault);
|
||||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||||
.Returns(PrecisionDefault);
|
.Returns(PrecisionDefault);
|
||||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Guiding Style", string.Empty, GuidingStyleDefault))
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Guiding Style", string.Empty, GuidingStyleDefault))
|
||||||
.Returns(GuidingStyleDefault);
|
.Returns(GuidingStyleDefault);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Backlash Compensation", string.Empty, BacklashCompensationDefault))
|
x.GetValueInt(DriverId, "Backlash Compensation", string.Empty, BacklashCompensationDefault.ToString()))
|
||||||
.Returns(BacklashCompensationDefault);
|
.Returns(BacklashCompensationDefault);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Reverse Focuser Direction", string.Empty, "true"))
|
x.GetValueBool(DriverId, "Reverse Focuser Direction", string.Empty, "true"))
|
||||||
.Returns(() => ReverseFocuserDiectionDefault);
|
.Returns(() => ReverseFocuserDiectionDefault);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
x.GetValueInt(DriverId, "Speed", string.Empty, SpeedDefault.ToString()))
|
||||||
.Returns(() => SpeedDefault);
|
.Returns(() => SpeedDefault);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
x.GetValueInt(DriverId, "Data Bits", string.Empty, DataBitsDefault.ToString()))
|
||||||
.Returns(() => DataBitsDefault);
|
.Returns(() => DataBitsDefault);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||||
@@ -212,7 +212,7 @@ namespace Meade.net.UnitTests
|
|||||||
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||||
.Returns(() => ParityDefault);
|
.Returns(() => ParityDefault);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Rts / Dtr", string.Empty, "false"))
|
x.GetValueBool(DriverId, "Rts / Dtr", string.Empty, "false"))
|
||||||
.Returns(() => RtsDtrEnabledDefault);
|
.Returns(() => RtsDtrEnabledDefault);
|
||||||
|
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
@@ -239,7 +239,7 @@ namespace Meade.net.UnitTests
|
|||||||
|
|
||||||
|
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Send Date and time on connect", string.Empty, "false"))
|
x.GetValueBool(DriverId, "Send Date and time on connect", string.Empty, "false"))
|
||||||
.Returns(() => SendDateTimeDefault);
|
.Returns(() => SendDateTimeDefault);
|
||||||
|
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
@@ -264,21 +264,21 @@ namespace Meade.net.UnitTests
|
|||||||
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
|
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
|
||||||
|
|
||||||
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
|
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
|
||||||
Is.EqualTo(double.Parse(GuideRateProfileNameDefault)));
|
Is.EqualTo(GuideRateProfileNameDefault));
|
||||||
Assert.That(profileProperties.Precision, Is.EqualTo(PrecisionDefault));
|
Assert.That(profileProperties.Precision, Is.EqualTo(PrecisionDefault));
|
||||||
Assert.That(profileProperties.GuidingStyle, Is.EqualTo(GuidingStyleDefault));
|
Assert.That(profileProperties.GuidingStyle, Is.EqualTo(GuidingStyleDefault));
|
||||||
|
|
||||||
Assert.That(profileProperties.BacklashCompensation, Is.EqualTo(int.Parse(BacklashCompensationDefault)));
|
Assert.That(profileProperties.BacklashCompensation, Is.EqualTo(BacklashCompensationDefault));
|
||||||
Assert.That(profileProperties.ReverseFocusDirection, Is.EqualTo(bool.Parse(ReverseFocuserDiectionDefault)));
|
Assert.That(profileProperties.ReverseFocusDirection, Is.EqualTo(ReverseFocuserDiectionDefault));
|
||||||
|
|
||||||
Assert.That(profileProperties.Speed, Is.EqualTo(int.Parse(SpeedDefault)));
|
Assert.That(profileProperties.Speed, Is.EqualTo(SpeedDefault));
|
||||||
Assert.That(profileProperties.DataBits, Is.EqualTo(int.Parse(DataBitsDefault)));
|
Assert.That(profileProperties.DataBits, Is.EqualTo(DataBitsDefault));
|
||||||
Assert.That(profileProperties.StopBits, Is.EqualTo(StopBitsDefault));
|
Assert.That(profileProperties.StopBits, Is.EqualTo(StopBitsDefault));
|
||||||
Assert.That(profileProperties.Handshake, Is.EqualTo(HandshakeDefault));
|
Assert.That(profileProperties.Handshake, Is.EqualTo(HandshakeDefault));
|
||||||
Assert.That(profileProperties.Parity, Is.EqualTo(ParityDefault));
|
Assert.That(profileProperties.Parity, Is.EqualTo(ParityDefault));
|
||||||
Assert.That(profileProperties.RtsDtrEnabled, Is.EqualTo(bool.Parse(RtsDtrEnabledDefault)));
|
Assert.That(profileProperties.RtsDtrEnabled, Is.EqualTo(RtsDtrEnabledDefault));
|
||||||
|
|
||||||
Assert.That(profileProperties.SendDateTime, Is.EqualTo(bool.Parse(SendDateTimeDefault)));
|
Assert.That(profileProperties.SendDateTime, Is.EqualTo(SendDateTimeDefault));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("TCP")]
|
[TestCase("TCP")]
|
||||||
@@ -692,15 +692,15 @@ namespace Meade.net.UnitTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("57600")]
|
[TestCase(57600)]
|
||||||
[TestCase("38400")]
|
[TestCase(38400)]
|
||||||
[TestCase("28800")]
|
[TestCase(28800)]
|
||||||
[TestCase("19200")]
|
[TestCase(19200)]
|
||||||
[TestCase("14400")]
|
[TestCase(14400)]
|
||||||
[TestCase("4800")]
|
[TestCase(4800)]
|
||||||
[TestCase("2400")]
|
[TestCase(2400)]
|
||||||
[TestCase("1200")]
|
[TestCase(1200)]
|
||||||
public void Connect_WhenSpeedIsFastAndAutostarAtDefault_ThenConnectsAutoStarSpeedChanged(string WantedSpeed)
|
public void Connect_WhenSpeedIsFastAndAutostarAtDefault_ThenConnectsAutoStarSpeedChanged(int WantedSpeed)
|
||||||
{
|
{
|
||||||
string deviceId = "Serial";
|
string deviceId = "Serial";
|
||||||
|
|
||||||
@@ -739,7 +739,7 @@ namespace Meade.net.UnitTests
|
|||||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||||
.Returns(PrecisionDefault);
|
.Returns(PrecisionDefault);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
x.GetValueInt(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||||
.Returns(() => WantedSpeed);
|
.Returns(() => WantedSpeed);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||||
@@ -812,15 +812,15 @@ namespace Meade.net.UnitTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("57600")]
|
[TestCase(57600)]
|
||||||
[TestCase("38400")]
|
[TestCase(38400)]
|
||||||
[TestCase("28800")]
|
[TestCase(28800)]
|
||||||
[TestCase("19200")]
|
[TestCase(19200)]
|
||||||
[TestCase("14400")]
|
[TestCase(14400)]
|
||||||
[TestCase("4800")]
|
[TestCase(4800)]
|
||||||
[TestCase("2400")]
|
[TestCase(2400)]
|
||||||
[TestCase("1200")]
|
[TestCase(1200)]
|
||||||
public void Connect_WhenAutostarReportsFailedToChangeSpeec_ThenConnectsAutoStarAtDefaultSpeed(string WantedSpeed)
|
public void Connect_WhenAutostarReportsFailedToChangeSpeec_ThenConnectsAutoStarAtDefaultSpeed(int WantedSpeed)
|
||||||
{
|
{
|
||||||
string deviceId = "Serial";
|
string deviceId = "Serial";
|
||||||
|
|
||||||
@@ -859,7 +859,7 @@ namespace Meade.net.UnitTests
|
|||||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||||
.Returns(PrecisionDefault);
|
.Returns(PrecisionDefault);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
x.GetValueInt(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||||
.Returns(() => WantedSpeed);
|
.Returns(() => WantedSpeed);
|
||||||
profileWrapperMock.Setup(x =>
|
profileWrapperMock.Setup(x =>
|
||||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||||
|
|||||||
Reference in New Issue
Block a user