mirror of
https://github.com/Biarity/Sieve.git
synced 2025-07-27 12:43:13 +02:00
Basic working & complete tests
This commit is contained in:
20
SieveTests/Entities/ApplicationDbContext.cs
Normal file
20
SieveTests/Entities/ApplicationDbContext.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SieveTests.Entities
|
||||
{
|
||||
public class ApplicationDbContext : DbContext
|
||||
{
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
|
||||
|
||||
public DbSet<Post> Posts { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
25
SieveTests/Entities/Post.cs
Normal file
25
SieveTests/Entities/Post.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Sieve.Attributes;
|
||||
|
||||
namespace SieveTests.Entities
|
||||
{
|
||||
public class Post
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public string Title { get; set; } = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 8);
|
||||
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public int LikeCount { get; set; } = new Random().Next(0, 1000);
|
||||
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public int CommentCount { get; set; } = new Random().Next(0, 1000);
|
||||
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public DateTimeOffset DateCreated { get; set; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user