From 44e02dda1d8b5f271ff990a6264f431a05dcde31 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 9 Jul 2019 18:05:12 +0100 Subject: [PATCH] Added unit test for setup dialog. --- .../Meade.net.Telescope.UnitTests.csproj | 1 + Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs | 11 +++++++++++ Meade.net.Telescope/Telescope.cs | 5 +++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Meade.net.Telescope.UnitTests/Meade.net.Telescope.UnitTests.csproj b/Meade.net.Telescope.UnitTests/Meade.net.Telescope.UnitTests.csproj index 89b3231..23613aa 100644 --- a/Meade.net.Telescope.UnitTests/Meade.net.Telescope.UnitTests.csproj +++ b/Meade.net.Telescope.UnitTests/Meade.net.Telescope.UnitTests.csproj @@ -26,6 +26,7 @@ prompt 4 false + x86 pdbonly diff --git a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs index 55c3af3..a427f0c 100644 --- a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs +++ b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs @@ -48,5 +48,16 @@ namespace Meade.net.Telescope.UnitTests { 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)); + } } } diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index 061bf0f..b0987af 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -75,8 +75,9 @@ namespace ASCOM.Meade.net public Telescope() { //todo move this out to IOC - _utilities = new Util(); //Initialise util object - _utilitiesExtra = new Util(); //Initialise util object + var util = new Util(); //Initialise util object + _utilities = util; + _utilitiesExtra = util; //Initialise util object _astroUtilities = new AstroUtils(); // Initialise astro utilities object _sharedResourcesWrapper = new SharedResourcesWrapper(); _astroMaths = new AstroMaths();