//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnServersMatchingAnyGroup() public virtual void ShouldReturnServersMatchingAnyGroup() { // given AnyGroupFilter groupFilter = new AnyGroupFilter(asSet("china-west", "europe")); ServerInfo serverA = new ServerInfo(new AdvertisedSocketAddress("bolt", 1), new MemberId(System.Guid.randomUUID()), asSet("china-west")); ServerInfo serverB = new ServerInfo(new AdvertisedSocketAddress("bolt", 2), new MemberId(System.Guid.randomUUID()), asSet("europe")); ServerInfo serverC = new ServerInfo(new AdvertisedSocketAddress("bolt", 3), new MemberId(System.Guid.randomUUID()), asSet("china", "china-west")); ServerInfo serverD = new ServerInfo(new AdvertisedSocketAddress("bolt", 4), new MemberId(System.Guid.randomUUID()), asSet("china-west", "china")); ServerInfo serverE = new ServerInfo(new AdvertisedSocketAddress("bolt", 5), new MemberId(System.Guid.randomUUID()), asSet("china-east", "asia")); ServerInfo serverF = new ServerInfo(new AdvertisedSocketAddress("bolt", 6), new MemberId(System.Guid.randomUUID()), asSet("europe-west")); ServerInfo serverG = new ServerInfo(new AdvertisedSocketAddress("bolt", 7), new MemberId(System.Guid.randomUUID()), asSet("china-west", "europe")); ServerInfo serverH = new ServerInfo(new AdvertisedSocketAddress("bolt", 8), new MemberId(System.Guid.randomUUID()), asSet("africa")); ISet <ServerInfo> data = asSet(serverA, serverB, serverC, serverD, serverE, serverF, serverG, serverH); // when ISet <ServerInfo> output = groupFilter.Apply(data); // then ISet <int> ports = new HashSet <int>(); foreach (ServerInfo info in output) { ports.Add(info.BoltAddress().Port); } assertEquals(asSet(1, 2, 3, 4, 7), ports); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || this.GetType() != o.GetType()) { return(false); } AnyGroupFilter that = ( AnyGroupFilter )o; return(Objects.Equals(_groups, that._groups)); }