コード例 #1
0
        public void Consume(ProponentRemovedEvent ev)
        {
            var currentProposal = _repo.GetById(ev.ProposalId);
            var warranty        = currentProposal.Proponents.Single(w => w.Id == ev.ProponentId);

            currentProposal.Proponents.Remove(warranty);
            currentProposal.Events.Add(ev);
            _repo.Update(currentProposal);
        }
コード例 #2
0
        public void Deveria_remover_o_proponente_da_proposta()
        {
            var proposalId  = Guid.NewGuid();
            var proponentId = Guid.NewGuid();

            List <Proposal> proposals = new List <Proposal>()
            {
                new Proposal(proposalId, 0, 0)
                .Add(new Proponent(proponentId, "old", 0, 0, false))
            };

            String stringEvent = $"{Guid.NewGuid()},proposal,created,{DateTime.Now},{proposalId},{proponentId}";

            var @event = new ProponentRemovedEvent(stringEvent.Split(','));

            @event.Change(ref proposals);

            var proposal = proposals.First();

            proposal.Proponents.Should().HaveCount(0, because: "O Proponente foi removido");
        }