コード例 #1
0
        public void should_return_id_by_cpf()
        {
            var election = new Election();

            var candidates = new List <Candidate> {
                new Candidate("José", "009.923.970-14"), new Candidate("José", "852.710.650-73")
            };

            election.CreateCandidates(candidates, "Pa$$w0rd");

            var candidate = election.GetCandidateIdByCPF("852.710.650-73");

            Assert.Equal(candidate, election.Candidates.ElementAt(1).Id);
        }
コード例 #2
0
        public void should_return_fernanda_id_by_cpf()
        {
            // Dado / Setup
            var election        = new Election();
            var fernanda1       = new Candidate("Fernanda", "109.876.543.21");
            var fernanda2       = new Candidate("Fernanda", "125.656.987-01");
            var candidatesInput = new List <Candidate> {
                fernanda1, fernanda2
            };

            election.CreateCandidates(candidatesInput, "Pa$$w0rd");

            // Quando / Ação
            var foundId = election.GetCandidateIdByCPF(fernanda1.Cpf);

            // Deve / Asserções
            Assert.Equal(election.Candidates.ElementAt(0).Id, foundId);
        }
コード例 #3
0
        public void should_return_rafael_id_by_cpf()
        {
            // Dado / Setup
            var election        = new Election();
            var rafael          = new Candidate("Rafael", "123.456.789.10");
            var fernanda        = new Candidate("Fernanda", "109.876.543.21");
            var joana           = new Candidate("Joana", "257.323.689-01");
            var candidatesInput = new List <Candidate> {
                rafael, fernanda, joana
            };

            election.CreateCandidates(candidatesInput, "Pa$$w0rd");

            // Quando / Ação
            var foundId = election.GetCandidateIdByCPF(rafael.Cpf);

            // Deve / Asserções
            Assert.Equal(election.Candidates.ElementAt(0).Id, foundId);
        }