mirror of
https://bitbucket.org/cjdskunkworks/lynxastrodewcontroller.git
synced 2026-05-03 17:28:52 +00:00
Added missing build.build file and fixed a couple of broken unit tests.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using ASCOM.LynxAstro.DewController;
|
||||
using ASCOM.Utilities.Interfaces;
|
||||
using Moq;
|
||||
@@ -99,7 +98,7 @@ namespace LynxAstro.DewController.UnitTests
|
||||
[Test]
|
||||
public void WriteProfile_WhenCalled_WritesExpectedProfileSettings()
|
||||
{
|
||||
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
string DriverId = "ASCOM.LynxAstro.DewController.Switch";
|
||||
|
||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||
profileWrapperMock.SetupAllProperties();
|
||||
@@ -119,7 +118,7 @@ namespace LynxAstro.DewController.UnitTests
|
||||
|
||||
SharedResources.WriteProfile(profileProperties);
|
||||
|
||||
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
||||
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Switch"));
|
||||
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);
|
||||
}
|
||||
@@ -127,7 +126,7 @@ namespace LynxAstro.DewController.UnitTests
|
||||
[Test]
|
||||
public void ReadProfile_WhenCalled_ReturnsExpectedDefaultValues()
|
||||
{
|
||||
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
string DriverId = "ASCOM.LynxAstro.DewController.Switch";
|
||||
|
||||
string ComPortDefault = "COM1";
|
||||
string TraceStateDefault = "false";
|
||||
@@ -140,25 +139,14 @@ namespace LynxAstro.DewController.UnitTests
|
||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||
profileWrapperMock.SetupAllProperties();
|
||||
|
||||
profileWrapperMock.Setup(x => x.DeviceType).Returns("Switch");
|
||||
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
.Returns(() =>
|
||||
TraceStateDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
.Returns(ComPortDefault);
|
||||
profileWrapperMock
|
||||
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
.Returns(PrecisionDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Guiding Style", string.Empty, GuidingStyleDefault))
|
||||
.Returns(GuidingStyleDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Backlash Compensation", string.Empty, BacklashCompensationDefault))
|
||||
.Returns(BacklashCompensationDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Reverse Focuser Direction", string.Empty, ReverseFocuserDiectionDefault))
|
||||
.Returns(() => ReverseFocuserDiectionDefault);
|
||||
|
||||
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, It.IsRegex("^SwitchName_[0-9{1}]$"), string.Empty, It.IsAny<string>()))
|
||||
.Returns((string driverId, string name, string subKey, string defaultValue) => defaultValue);
|
||||
@@ -172,7 +160,7 @@ namespace LynxAstro.DewController.UnitTests
|
||||
|
||||
var profileProperties = SharedResources.ReadProfile();
|
||||
|
||||
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
||||
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Switch"));
|
||||
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
|
||||
Assert.That(profileProperties.TraceLogger, Is.EqualTo(bool.Parse(TraceStateDefault)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user