Exemplo n.º 1
0
    static async Task <List <Electorate> > WriteElectoratesMetaData()
    {
        var electorates = new List <Electorate>();

        foreach (var electoratePair in electorateNames)
        {
            foreach (var electorateName in electoratePair.Value)
            {
                var existIn2016   = electorates2016.Contains(electorateName);
                var existIn2019   = electorates2019.Contains(electorateName);
                var existInFuture = electoratesFuture.Contains(electorateName);
                var electorate    = await ElectoratesScraper.ScrapeElectorate(electorateName, electoratePair.Key);

                electorate.Exist2016     = existIn2016;
                electorate.Exist2019     = existIn2019;
                electorate.ExistInFuture = existInFuture;
                electorates.Add(electorate);
            }
        }

        var combine = Path.Combine(DataLocations.DataPath, "electorates.json");

        File.Delete(combine);
        JsonSerializer.Serialize(electorates, combine);
        return(electorates);
    }
Exemplo n.º 2
0
    public async Task <Task> Run()
    {
        var lingiari = await ElectoratesScraper.ScrapeCurrentElectorate("lingiari", State.NT);

        var bass = await ElectoratesScraper.ScrapeCurrentElectorate("clark", State.TAS);

        var banks = await ElectoratesScraper.ScrapeCurrentElectorate("banks", State.NSW);

        var northernTerritory = await ElectoratesScraper.ScrapeCurrentElectorate("northern-territory", State.NT);

        var denison = await ElectoratesScraper.Scrape2016Electorate("denison", State.TAS);

        var fenner = await ElectoratesScraper.ScrapeCurrentElectorate("fenner", State.ACT);

        var hunter = await ElectoratesScraper.ScrapeCurrentElectorate("hunter", State.NSW);

        var spence = await ElectoratesScraper.ScrapeCurrentElectorate("spence", State.SA);

        var cook = await ElectoratesScraper.ScrapeCurrentElectorate("cook", State.NSW);

        var canberra = await ElectoratesScraper.ScrapeCurrentElectorate("canberra", State.ACT);

        var bean = await ElectoratesScraper.ScrapeCurrentElectorate("bean", State.ACT);

        var batman = await ElectoratesScraper.ScrapeCurrentElectorate("batman", State.VIC);

        var melbourne = await ElectoratesScraper.ScrapeCurrentElectorate("melbourne", State.VIC);

        return(Verify(new { northernTerritory, lingiari, denison, melbourne, banks, hunter, batman, spence, cook, bean, fenner, canberra, bass }));
    }
Exemplo n.º 3
0
    public async Task Run()
    {
        var denison = await ElectoratesScraper.ScrapeElectorate("denison", State.TAS);

        var bass = await ElectoratesScraper.ScrapeElectorate("bass", State.TAS);

        var fenner = await ElectoratesScraper.ScrapeElectorate("fenner", State.ACT);

        var hunter = await ElectoratesScraper.ScrapeElectorate("hunter", State.NSW);

        var spence = await ElectoratesScraper.ScrapeElectorate("spence", State.SA);

        var cook = await ElectoratesScraper.ScrapeElectorate("cook", State.NSW);

        var canberra = await ElectoratesScraper.ScrapeElectorate("canberra", State.ACT);

        var bean = await ElectoratesScraper.ScrapeElectorate("bean", State.ACT);

        var batman = await ElectoratesScraper.ScrapeElectorate("batman", State.VIC);

        var melbourne = await ElectoratesScraper.ScrapeElectorate("melbourne", State.VIC);

        ObjectApprover.VerifyWithJson(new { denison, melbourne, hunter, batman, spence, cook, bean, fenner, canberra, bass });
    }