Add a test to show the broken item

This commit is contained in:
Tim Young 2017-08-26 08:16:45 -05:00
parent eddfb773c0
commit ea3f2adb65

View File

@ -1953,6 +1953,19 @@ namespace EduNetworkBuilder
return didit; 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) int BreakNetworkPath(TraversalClass ThePath, HowToBreak How)
{ {
//find the device name it belongs to //find the device name it belongs to
@ -1971,7 +1984,16 @@ namespace EduNetworkBuilder
if(NC != null) if(NC != null)
{ {
int answer = BreakNetComponent(NC, How); 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++; count++;