mirror of
https://github.com/Biarity/Sieve.git
synced 2025-09-20 23:29:39 +02:00
interface type fixes & unit test improvements
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using SieveUnitTests.Abstractions.Strategy;
|
||||
|
||||
namespace SieveUnitTests.Abstractions.Entity
|
||||
{
|
||||
public interface IBaseEntity
|
||||
public interface IBaseEntity: ISupportSoftDelete
|
||||
{
|
||||
int Id { get; set; }
|
||||
DateTimeOffset DateCreated { get; set; }
|
||||
|
@@ -1,9 +1,10 @@
|
||||
using Sieve.Attributes;
|
||||
using SieveUnitTests.Abstractions.Strategy;
|
||||
using SieveUnitTests.Entities;
|
||||
|
||||
namespace SieveUnitTests.Abstractions.Entity
|
||||
{
|
||||
public interface IPost: IBaseEntity
|
||||
public interface IPost: IBaseEntity, IAudit
|
||||
{
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
string Title { get; set; }
|
||||
|
@@ -4,13 +4,17 @@ namespace SieveUnitTests.Abstractions.Entity
|
||||
{
|
||||
public class SieveConfigurationForIPost : ISieveConfiguration
|
||||
{
|
||||
public void Configure(SievePropertyMapper mapper)
|
||||
public static void ConfigureStatic(SievePropertyMapper mapper)
|
||||
{
|
||||
mapper
|
||||
.Property<IPost>(p => p.Id)
|
||||
.CanSort();
|
||||
|
||||
mapper.Property<IPost>(p => p.ThisHasNoAttributeButIsAccessible)
|
||||
.CanSort()
|
||||
.CanFilter()
|
||||
.HasName("shortname");
|
||||
|
||||
|
||||
mapper.Property<IPost>(p => p.TopComment.Text)
|
||||
.CanFilter();
|
||||
|
||||
@@ -32,6 +36,21 @@ namespace SieveUnitTests.Abstractions.Entity
|
||||
.Property<IPost>(p => p.DateCreated)
|
||||
.CanSort()
|
||||
.HasName("CreateDate");
|
||||
|
||||
mapper
|
||||
.Property<IPost>(post => post.DeletedBy)
|
||||
.CanSort()
|
||||
.HasName("DeletedBy");
|
||||
|
||||
mapper
|
||||
.Property<IPost>(post => post.UpdatedBy)
|
||||
.CanFilter()
|
||||
.HasName("UpdatedBy");
|
||||
}
|
||||
|
||||
public void Configure(SievePropertyMapper mapper)
|
||||
{
|
||||
ConfigureStatic(mapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
SieveUnitTests/Abstractions/Strategy/IAudit.cs
Normal file
12
SieveUnitTests/Abstractions/Strategy/IAudit.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace SieveUnitTests.Abstractions.Strategy
|
||||
{
|
||||
public interface IAudit
|
||||
{
|
||||
string CreatedBy { get; }
|
||||
DateTime? CreatedAt { get; }
|
||||
string UpdatedBy { get; }
|
||||
DateTime? UpdatedAt { get; }
|
||||
}
|
||||
}
|
10
SieveUnitTests/Abstractions/Strategy/ISupportSoftDelete.cs
Normal file
10
SieveUnitTests/Abstractions/Strategy/ISupportSoftDelete.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace SieveUnitTests.Abstractions.Strategy
|
||||
{
|
||||
public interface ISupportSoftDelete
|
||||
{
|
||||
string DeletedBy { get; }
|
||||
DateTime? DeletedAt { get; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user