Skip to content

Commit 2731940

Browse files
committed
Adicionado configuracoes para os testes de integracao
1 parent 14f40a4 commit 2731940

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

TesteBackendEnContact.Data/Configurations/CompanyConfiguration.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ public class CompanyConfiguration : IEntityTypeConfiguration<Company>
88
{
99
public void Configure(EntityTypeBuilder<Company> builder)
1010
{
11-
11+
builder.ToTable("Companies");
12+
13+
builder.HasKey(x => x.Id);
1214
}
1315
}
1416
}

TesteBackendEnContact.Data/TesteBackendEnContactContext.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ public class TesteBackendEnContactContext: DbContext
99
public DbSet<Company> Companies { get; set; }
1010
public DbSet<Contact> Contacts { get; set; }
1111
public DbSet<ContactBook> ContactBooks { get; set; }
12-
public TesteBackendEnContactContext(DbContextOptions<TesteBackendEnContactContext> options) : base(options){}
12+
public TesteBackendEnContactContext(DbContextOptions<TesteBackendEnContactContext> options) : base(options)
13+
{
14+
Database.EnsureCreated();
15+
}
1316

1417
protected override void OnModelCreating(ModelBuilder modelBuilder)
1518
{
19+
1620
modelBuilder.ApplyConfiguration(new CompanyConfiguration());
1721

1822
modelBuilder.ApplyConfiguration(new ContactConfiguration());

0 commit comments

Comments
 (0)