Skip to content

Commit e2f789d

Browse files
committed
Add DbContext for test
1 parent cc038d4 commit e2f789d

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.Data.Entity;
5+
using System.Linq;
6+
7+
namespace UnitTest.Database
8+
{
9+
public class RandomTestDb : DbContext
10+
{
11+
public DbSet<Category> Categories { get; set; }
12+
public DbSet<Product> Products { get; set; }
13+
}
14+
15+
public class Category
16+
{
17+
[MaxLength(36)]
18+
public string Id { get; set; }
19+
public DateTime Created { get; set; }
20+
[Required]
21+
[MaxLength(20)]
22+
public string Name { get; set; }
23+
}
24+
25+
public class Product
26+
{
27+
public Guid Id { get; set; }
28+
public DateTime Created { get; set; }
29+
[Required]
30+
[MaxLength(20)]
31+
public string Name { get; set; }
32+
}
33+
}

RandomData2/UnitTest/UnitTest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
<Compile Include="Client\GlobalTest.cs" />
7070
<Compile Include="Client\HttpHelper.cs" />
7171
<Compile Include="Client\RandomTest.cs" />
72+
<Compile Include="Database\RandomTestDb.cs" />
7273
<Compile Include="Properties\AssemblyInfo.cs" />
7374
</ItemGroup>
7475
<ItemGroup>

0 commit comments

Comments
 (0)