public void GetGatewayLinksTest() { var testGatewayLink = new GatewayLink("test", "test", false); var mockStorage = new DataStorage() { gatewayLinks = { testGatewayLink } }; Controller testController = new Controller(mockStorage); var result = testController.GetGatewayLinks().Value; Assert.Contains(testGatewayLink, result); }
public void constructSingleGatewayLinks() { foreach (var connection in _dataStorage.clusterConnectionErrors) { var tuple = stringToTuple(connection.Key); var source = tuple.Item1; var target = tuple.Item2; foreach (var gateway in _dataStorage.gateways) { if (gateway.name != source && gateway.name != target) { continue; } if (source == target) { continue; } if (gateway.name == target) { continue; } if (!gateway.outbound_gateways .ContainsKey(target) /*|| !gateway.outbound_gateways.ContainsKey(source)*/) { // TODO tjek hvilken cluster det er til og fra connection.Value.Add("Missing gateway from cluster " + gateway.name + " to cluster " + target + " for server " + gateway.server_id); } } } foreach (var cluster in _dataStorage.clusterConnectionErrors) { var split = cluster.Key.Split(" NAMESPLIT "); var source = split[0]; var target = split[1]; var link = new GatewayLink(source, target, cluster.Value.Count > 0); link.errors = cluster.Value; foreach (var err in cluster.Value) { link.errorsAsString += "\n" + err; } _dataStorage.gatewayLinks.Add(link); } }