private void Add(ILocationQuery locationQuery, Country australia, string capitalName, string stateName, string capitalId, string regionalId) { var capital = _world.GetPointSet(locationQuery.GetRegion(australia, capitalName)); _mappings.Add(new KeyValuePair <HashSet <int>, string>(capital, capitalId)); var state = _world.GetPointSet(locationQuery.GetCountrySubdivision(australia, stateName)); _mappings.Add(new KeyValuePair <HashSet <int>, string>( new HashSet <int>(state.Except(capital)), regionalId)); }
public static void ClassInitialize(TestContext context) { _indexWriter = new IndexWriter(new RAMDirectory(), new SimpleAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED); _australia = LocationQuery.GetCountry("Australia"); _victoria = new LocationReference(LocationQuery.GetCountrySubdivision(_australia, "VIC")); _tasmania = new LocationReference(LocationQuery.GetCountrySubdivision(_australia, "TAS")); _queensland = new LocationReference(LocationQuery.GetCountrySubdivision(_australia, "QLD")); _devonport = new LocationReference(LocationQuery.GetPostalCode(_australia, "7310").Locality); _hobart = new LocationReference(LocationQuery.GetRegion(_australia, "Hobart")); _melbourne = new LocationReference(LocationQuery.GetRegion(_australia, "Melbourne")); _goldCoast = new LocationReference(LocationQuery.GetRegion(_australia, "Gold Coast")); _nearGoldCoast = new LocationReference(LocationQuery.GetPostalCode(_australia, "4227").Locality); _armadale = new LocationReference(LocationQuery.GetPostalCode(_australia, "3143")); _malvern = new LocationReference(LocationQuery.GetPostalSuburb(LocationQuery.GetPostalCode(_australia, "3144"), "Malvern")); _nearArmadale = new LocationReference(LocationQuery.GetPostalCode(_australia, "3181").Locality); _indexer = new Indexer(new MemberSearchBooster(), LocationQuery, Resolve <IIndustriesQuery>(), null); // Zero - not willing to relocate. _zero = Guid.NewGuid(); IndexContent(new MemberContent { Member = new Member { Id = _zero, Address = new Address { Location = ResolvePostalSuburb("Malvern VIC") } }, Candidate = new Candidate(), }); // One - in NSW, but willing to relocate to Armadale or Malvern or TAS _one = Guid.NewGuid(); IndexContent(new MemberContent { Member = new Member { Id = _one, Address = new Address { Location = ResolvePostalSuburb("Woolloomooloo NSW"), } }, Candidate = new Candidate { RelocationPreference = RelocationPreference.Yes, RelocationLocations = new[] { _armadale, _malvern, _tasmania } }, }); // Three - would consider relocating anywhere in Australia _three = Guid.NewGuid(); IndexContent(new MemberContent { Member = new Member { Id = _three, Address = new Address { Location = ResolvePostalSuburb("Caulfield VIC"), } }, Candidate = new Candidate { RelocationPreference = RelocationPreference.Yes, RelocationLocations = new[] { new LocationReference(LocationQuery.GetCountrySubdivision(_australia, null)) } }, }); // Four - "would consider" relocating to Gold Coast (region) _four = Guid.NewGuid(); IndexContent(new MemberContent { Member = new Member { Id = _four, Address = new Address { Location = ResolvePostalSuburb("VIC"), } }, Candidate = new Candidate { RelocationPreference = RelocationPreference.Yes, RelocationLocations = new[] { _goldCoast } }, }); _indexSearcher = new IndexSearcher(_indexWriter.getReader()); }