Beispiel #1
0
        public CursoTest(ITestOutputHelper output)
        {
            var faker = new Faker();

            _output = output;
            _output.WriteLine("Construtor Sendo Executado");
            _nome         = faker.Commerce.ProductName();
            _descricao    = faker.Lorem.Paragraph();
            _cargaHoraria = faker.Random.Double(1, 100);
            _publicoAlvo  = PublicoALvo.Estudante;
            _valor        = faker.Random.Double(100, 1000);
        }
        public Curso(string nome, string descricao, double cargaHoraria, PublicoALvo publicoAlvo, double valor)
        {
            if (string.IsNullOrEmpty(nome))
            {
                throw new ArgumentException("Nome Inválido");
            }

            if (cargaHoraria < 1)
            {
                throw new ArgumentException("Carga Horária Inválida");
            }

            if (valor < 1)
            {
                throw new ArgumentException("Valor Inválido");
            }

            this.Nome         = nome;
            this.Descricao    = descricao;
            this.CargaHoraria = cargaHoraria;
            this.PublicoAlvo  = publicoAlvo;
            this.Valor        = valor;
        }