From ea3f2adb6506b9db41163c9f807fe8cc62757d8c Mon Sep 17 00:00:00 2001 From: Tim Young Date: Sat, 26 Aug 2017 08:16:45 -0500 Subject: [PATCH] Add a test to show the broken item --- EduNetworkBuilder/Network.cs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 17e6a15..2e923cd 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -1953,6 +1953,19 @@ namespace EduNetworkBuilder return didit; } + bool AlreadyHasPingTest(string source, string dest) + { + foreach (NetTest NT in NetTests) + { + if (NT.TheTest == NetTestType.SuccessfullyPings) + { + if (NT.sHost == source && NT.dHost == dest) return true; + if (NT.sHost == dest && NT.dHost == source) return true; + } + } + return false; + } + int BreakNetworkPath(TraversalClass ThePath, HowToBreak How) { //find the device name it belongs to @@ -1971,7 +1984,16 @@ namespace EduNetworkBuilder if(NC != null) { int answer = BreakNetComponent(NC, How); - if (answer>0) return answer; + if (answer > 0) + { + if(!AlreadyHasPingTest(ThePath.Source(), ThePath.Destination())) + { + //Add a test to show this is broken. + NetTest NT = new NetTest(ThePath.Source(), ThePath.Destination(), NetTestType.SuccessfullyPings); + NetTests.Add(NT); + } + return answer; + } } } count++;