Created
May 28, 2018 17:06
-
-
Save StephanyBatista/5d9d421d9135c4ad7c07e0994da40ebc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using CursoOnline.Dominio.Cursos; | |
using CursoOnline.DominioTest.Cursos; | |
namespace CursoOnline.DominioTest._Builders | |
{ | |
public class CursoBuilder | |
{ | |
private string _nome = "Informática básica"; | |
private double _cargaHoraria = 80; | |
private PublicoAlvo _publicoAlvo = PublicoAlvo.Estudante; | |
private double _valor = 950; | |
private string _descricao = "Uma descrição"; | |
private int _id; | |
public static CursoBuilder Novo() | |
{ | |
return new CursoBuilder(); | |
} | |
public CursoBuilder ComNome(string nome) | |
{ | |
_nome = nome; | |
return this; | |
} | |
public CursoBuilder ComDescricao(string descricao) | |
{ | |
_descricao = descricao; | |
return this; | |
} | |
public CursoBuilder ComCargaHoraria(double cargaHoraria) | |
{ | |
_cargaHoraria = cargaHoraria; | |
return this; | |
} | |
public CursoBuilder ComValor(double valor) | |
{ | |
_valor = valor; | |
return this; | |
} | |
public CursoBuilder ComPublicoAlvo(PublicoAlvo publicoAlvo) | |
{ | |
_publicoAlvo = publicoAlvo; | |
return this; | |
} | |
public CursoBuilder ComId(int id) | |
{ | |
_id = id; | |
return this; | |
} | |
public Curso Build() | |
{ | |
return new Curso(_nome, _descricao, _cargaHoraria, _publicoAlvo, _valor); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment