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 | |
{ |
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
[Theory] | |
[InlineData("")] | |
[InlineData(null)] | |
public void NaoDeveCursoTerUmNomeInvalido(string nomeInvalido) | |
{ | |
Assert.Throws<ExcecaoDeDominio>(() => | |
CursoBuilder.Novo().ComNome(nomeInvalido).Build()) | |
.ComMensagem(Resource.NomeInvalido); | |
} |
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
var cidade = FluentBuilder<Cidade>.New().With(c => c.Nome, "Campo Grande").Build(); |
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.IO; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.EntityFrameworkCore.Design; | |
using Microsoft.Extensions.Configuration; | |
namespace StoreOfBuild.Data.Contexts | |
{ | |
public class ContextFactory : IDesignTimeDbContextFactory<ApplicationDbContext> | |
{ | |
public ApplicationDbContext CreateDbContext() |
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
services.AddIdentity<ApplicationUser, IdentityRole>(config => { | |
config.Password.RequireDigit = false; | |
config.Password.RequiredLength = 3; | |
config.Password.RequireLowercase = false; | |
config.Password.RequireNonAlphanumeric = false; | |
config.Password.RequireUppercase = false; | |
//Does not work in Core 2.1. | |
//config.Cookies.ApplicationCookie.LoginPath = "/Account/Login"; | |
}) | |
.AddEntityFrameworkStores<ApplicationDbContext>() |
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
[Fact] | |
public void DeveCriarCurso() | |
{ | |
var curso = new Curso(nomeEsperado, descricaoEsperada, valorEsperado); | |
Assert.Equal(nomeEsperado, curso.Nome); | |
Assert.Equal(descricaoEsperada, curso.Descricao); | |
Assert.Equal(valorEsperado, curso.Valor); | |
} |
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
[Fact] | |
public void DeveCriarCursoComNome() | |
{ | |
var curso = new Curso(nomeEsperado, descricaoEsperada, valorEsperado); | |
Assert.Equal(nomeEsperado, curso.Nome); | |
} | |
[Fact] | |
public void DeveCriarCursoComDescricao() |
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
[Fact] | |
public void DeveCriarUmCurso() | |
{ | |
var cursoEsperado = new | |
{ | |
Nome = _nome, | |
Valor = _valor, | |
Descricao = _descricao | |
}; |
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
var fake = new Faker(); | |
_cursoDto = new CursoDto | |
{ | |
Nome = fake.Random.Words(), | |
Descricao = fake.Lorem.Paragraph(), | |
CargaHoraria = fake.Random.Double(50, 1000), | |
PublicoAlvo = "Estudante", | |
Valor = fake.Random.Double(1000, 2000) | |
}; |
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
var nomeEsperado = "Teste"; | |
var precoEsperado = 1; | |
var curso = new Curso("Teste", 1); |