From 34f304179f9e774facf43b8c971d68c75ff510b8 Mon Sep 17 00:00:00 2001 From: Michele Cattafesta Date: Mon, 2 Feb 2015 22:44:05 +0100 Subject: [PATCH] Fixes a problem that prevented to run unit tests on a pc without Step7 installed. Signed-off-by: Michele Cattafesta --- S7.Net.UnitTest/S7NetTests.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/S7.Net.UnitTest/S7NetTests.cs b/S7.Net.UnitTest/S7NetTests.cs index c1f7bd5..51ca5b7 100644 --- a/S7.Net.UnitTest/S7NetTests.cs +++ b/S7.Net.UnitTest/S7NetTests.cs @@ -193,13 +193,17 @@ namespace S7.Net.UnitTest private static void ShutDownServiceS7oiehsx64() { - ServiceController sc = new ServiceController("s7oiehsx64"); - switch (sc.Status) + try { - case ServiceControllerStatus.Running: - sc.Stop(); - break; + ServiceController sc = new ServiceController("s7oiehsx64"); + switch (sc.Status) + { + case ServiceControllerStatus.Running: + sc.Stop(); + break; + } } + catch { } // service not found } #endregion