Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var alunoRepository = new AlunoRepository();
            var turmaRepository = new TurmaRepository();

            var alunoBusiness = new AlunoBusiness(alunoRepository);
            var turmaBusiness = new TurmaBusiness(turmaRepository);

            var alunoService = new AlunoService(alunoBusiness);
            var turmaService = new TurmaService(turmaBusiness);

            var alunos = alunoService.Insert(new Aluno {
                Id = 1, Nome = "AAAA"
            });
            var turmas = turmaService.Insert(new Turma
            {
                Numero  = "101",
                Periodo = Domain.ValueObj.Periodo.noite,
                Alunos  = new List <Aluno>()
                {
                    new Aluno {
                        Id = 1, Nome = "AAAA"
                    },
                    new Aluno {
                        Id = 1, Nome = "BBBB"
                    },
                    new Aluno {
                        Id = 1, Nome = "CCCC"
                    }
                }
            });

            Console.WriteLine($"{alunos.Any()} {alunos.Count()} {alunos[0].Nome}");
            Console.WriteLine($"{turmas.Any()} {turmas.Count()} {turmas[0].Numero}");
        }
Ejemplo n.º 2
0
        public void TestaInclusao()
        {
            TurmaService turmaService = new TurmaService();

            COBOL.Entidades.Turma turma = new COBOL.Entidades.Turma
            {
                CodigoDaTurma = 1,
                DataInicio    = DateTime.Now
            };

            var retorno = turmaService.Insert(turma);

            Assert.True(retorno != null);
        }