Added unit test for setup dialog.

This commit is contained in:
2019-07-09 18:05:12 +01:00
parent c72d2c00fc
commit 44e02dda1d
3 changed files with 15 additions and 2 deletions
@@ -26,6 +26,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -48,5 +48,16 @@ namespace Meade.net.Telescope.UnitTests
{ {
Assert.That(_telescope.Connected, Is.False); Assert.That(_telescope.Connected, Is.False);
} }
[Test]
public void SetupDialog()
{
_sharedResourcesWrapperMock.Verify(x => x.ReadProfile(), Times.Once);
_telescope.SetupDialog();
_sharedResourcesWrapperMock.Verify( x => x.SetupDialog(), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.ReadProfile(), Times.Exactly(2));
}
} }
} }
+3 -2
View File
@@ -75,8 +75,9 @@ namespace ASCOM.Meade.net
public Telescope() public Telescope()
{ {
//todo move this out to IOC //todo move this out to IOC
_utilities = new Util(); //Initialise util object var util = new Util(); //Initialise util object
_utilitiesExtra = new Util(); //Initialise util object _utilities = util;
_utilitiesExtra = util; //Initialise util object
_astroUtilities = new AstroUtils(); // Initialise astro utilities object _astroUtilities = new AstroUtils(); // Initialise astro utilities object
_sharedResourcesWrapper = new SharedResourcesWrapper(); _sharedResourcesWrapper = new SharedResourcesWrapper();
_astroMaths = new AstroMaths(); _astroMaths = new AstroMaths();