Beispiel #1
0
        public MockAgendaRepository(ISalaRepository salaRepository)
        {
            this.salaRepository = salaRepository;

            context.Add(new Agenda
            {
                Id            = 1,
                HorarioInicio = new DateTime(2019, 1, 12),
                HorarioFim    = new DateTime(2019, 1, 20),
                Sala          = salaRepository.GetAsync(1).Result,
            });

            context.Add(new Agenda
            {
                Id            = 2,
                HorarioInicio = new DateTime(2019, 1, 12),
                HorarioFim    = new DateTime(2019, 1, 20),
                Sala          = salaRepository.GetAsync(2).Result,
            });

            foreach (var item in context)
            {
                item.SalaId = item.Sala?.Id ?? 0;
            }
        }
Beispiel #2
0
 private void AddSalaToAgenda(Agenda entity)
 {
     if (entity.Sala == null || entity.Sala.Id != entity.SalaId)
     {
         entity.Sala = salaRepository.GetAsync(entity.SalaId).Result;
     }
 }